mirror of
https://github.com/keymanapp/keyman.git
synced 2026-11-03 09:37:47 +00:00
Merge pull request #16140 from keymanapp/fix/developer/11916-warn-on-race-destroying-appsource
fix(developer): warn only on race when destroying TAppSourceHttpResponder
This commit is contained in:
commit
4f72d7f2bb
2 changed files with 22 additions and 6 deletions
|
|
@ -76,11 +76,22 @@ var
|
|||
begin
|
||||
T := FSources.LockList;
|
||||
try
|
||||
// Note: Unlike regular functions, Assert has short-circuit evaluation
|
||||
// intrinsics on the first param which makes it safe to dereference T[0] in
|
||||
// the second parameter.
|
||||
Assert(T.Count = 0, 'TAppSourceHttpResponder.Sources should be empty at destruction '+
|
||||
'(T.Count='+IntToStr(T.Count)+', T[0].Filename='+T[0].Filename+')');
|
||||
// There is a race where RegisterSource is called on the server side
|
||||
// where a request is started in the form but the server does not respond
|
||||
// before the form is destroyed:
|
||||
// 1. http request starts on form
|
||||
// 2. Form destroyed, calls UnregisterSource
|
||||
// 3. http request received in TAppSourceHttpResponder,
|
||||
// RespondTouchEditorState calls RegisterSource
|
||||
// 4. Ooops
|
||||
|
||||
// There is another race somewhere with unsaved text editors, or else a
|
||||
// resource leak. For now, we'll report this as a message rather than crash.
|
||||
if T.Count > 0 then
|
||||
begin
|
||||
TKeymanSentryClient.Instance.ReportMessage('TAppSourceHttpResponder.Sources should be empty at destruction '+
|
||||
'(T.Count='+IntToStr(T.Count)+', T[0].Filename='+T[0].Filename+')', True);
|
||||
end;
|
||||
finally
|
||||
FSources.UnlockList;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -486,7 +486,12 @@ procedure TframeTextEditor.LoadFileInBrowser(const AData: string);
|
|||
function GenerateNewFilename: string;
|
||||
begin
|
||||
Inc(FInitialFilenameIndex);
|
||||
Result := '*texteditor*'+IntToStr(FInitialFilenameIndex);
|
||||
Result := '*texteditor';
|
||||
if Owner <> nil then
|
||||
Result := Result + '*' + Owner.ClassName;
|
||||
if Parent <> nil then
|
||||
Result := Result + '*' + Parent.Name;
|
||||
Result := Result + '*'+IntToStr(FInitialFilenameIndex);
|
||||
end;
|
||||
function EncodeFont(const prefix: string; f: TFont): string;
|
||||
begin
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue