Merge pull request #4921 from keymanapp/fix/windows/cherry-pick/4848-access-violation-closing-text-editor

fix(windows): access violation closing text editor 🍒
This commit is contained in:
Marc Durdin 2021-04-21 10:21:54 +10:00 committed by GitHub
commit 87cbff4e4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View file

@ -480,7 +480,7 @@ begin
fmTextEditor:
begin // I2720
FMutex := TKeymanMutex.Create('KeymanTextEditor');
if FMutex.MutexOwned then OpenTextEditor(nil) else FocusTextEditor;
if FMutex.MutexOwned then OpenTextEditor else FocusTextEditor;
end;
fmBaseKeyboard: // I4169

View file

@ -181,7 +181,7 @@ type
public
end;
procedure OpenTextEditor(Owner: TComponent = nil); // I2260
procedure OpenTextEditor; // I2260
implementation
@ -223,20 +223,16 @@ resourcestring
const
GutterWid = 6;
procedure OpenTextEditor(Owner: TComponent = nil); // I2260
procedure OpenTextEditor; // I2260
var
frmTextEditor: TfrmTextEditor;
begin
if ApplicationRunning then
begin
frmTextEditor := TfrmTextEditor.Create(nil);
frmTextEditor.Show;
end
else
begin
UfrmWebContainer.CreateForm(TfrmTextEditor, frmTextEditor);
frmTextEditor.Visible := True;
end;
UfrmWebContainer.CreateForm(TfrmTextEditor, frmTextEditor);
frmTextEditor.Visible := True;
ApplicationRunning := True;
Application.Run;
ApplicationRunning := False;
FreeAndNil(frmTextEditor);
end;
{ TfrmTextEditor }