Revert r4003, as issue #2651 could easily be caused by an assigned-check of FPreferencesDialog, which is freed in Toptionsform.FormClose in any case, but leaves the FPreferencesDialog assigned.

This commit is contained in:
Ansgar Becker
2013-09-24 22:07:17 +00:00
parent 6091da3ed8
commit 6c45158f31

View File

@ -950,7 +950,6 @@ type
FDBObjectsMaxSize: Int64; FDBObjectsMaxSize: Int64;
FDBObjectsMaxRows: Int64; FDBObjectsMaxRows: Int64;
FSearchReplaceDialog: TfrmSearchReplace; FSearchReplaceDialog: TfrmSearchReplace;
FPreferencesDialog: Toptionsform;
FGridEditFunctionMode: Boolean; FGridEditFunctionMode: Boolean;
FClipboardHasNull: Boolean; FClipboardHasNull: Boolean;
FTimeZoneOffset: Integer; FTimeZoneOffset: Integer;
@ -1957,10 +1956,13 @@ begin
end; end;
procedure TMainForm.actPreferencesExecute(Sender: TObject); procedure TMainForm.actPreferencesExecute(Sender: TObject);
var
Dialog: Toptionsform;
begin begin
// Preferences // Preferences
FPreferencesDialog := Toptionsform.Create(Self); Dialog := Toptionsform.Create(Self);
FPreferencesDialog.ShowModal; Dialog.ShowModal;
// Gets freed in Dialog.FormClose
end; end;
procedure TMainForm.actReadmeExecute(Sender: TObject); procedure TMainForm.actReadmeExecute(Sender: TObject);
@ -10244,8 +10246,6 @@ begin
Editors.Add(SynMemoSQLLog); Editors.Add(SynMemoSQLLog);
if Assigned(ActiveObjectEditor) then if Assigned(ActiveObjectEditor) then
FindEditors(ActiveObjectEditor); FindEditors(ActiveObjectEditor);
if Assigned(FPreferencesDialog) then
Editors.Add(FPreferencesDialog.SynMemoSQLSample);
if AppSettings.ReadBool(asTabsToSpaces) then if AppSettings.ReadBool(asTabsToSpaces) then
BaseEditor.Options := BaseEditor.Options + [eoTabsToSpaces] BaseEditor.Options := BaseEditor.Options + [eoTabsToSpaces]
@ -10253,12 +10253,7 @@ begin
BaseEditor.Options := BaseEditor.Options - [eoTabsToSpaces]; BaseEditor.Options := BaseEditor.Options - [eoTabsToSpaces];
ActiveLineColor := StringToColor(AppSettings.ReadString(asSQLColActiveLine)); ActiveLineColor := StringToColor(AppSettings.ReadString(asSQLColActiveLine));
for i:=0 to Editors.Count-1 do begin for i:=0 to Editors.Count-1 do begin
// See issue #2651:
if Editors[i]=nil then
Continue;
Editor := Editors[i] as TSynMemo; Editor := Editors[i] as TSynMemo;
if Editor = nil then
continue;
LogSQL('Setting up TSynMemo "'+Editor.Name+'"', lcDebug); LogSQL('Setting up TSynMemo "'+Editor.Name+'"', lcDebug);
Editor.Font.Name := AppSettings.ReadString(asFontName); Editor.Font.Name := AppSettings.ReadString(asFontName);
Editor.Font.Size := AppSettings.ReadInt(asFontSize); Editor.Font.Size := AppSettings.ReadInt(asFontSize);