Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,23 @@ destructor TAppSourceHttpResponder.Destroy;
// 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.
Comment on lines 79 to 81

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is now outdated and should be removed or updated

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;
Expand Down
7 changes: 6 additions & 1 deletion developer/src/tike/main/UframeTextEditor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down