FileBrowser: fix AV

This commit is contained in:
Ondrej Pokorny 2024-08-03 19:35:02 +02:00
parent aae7ed1f94
commit c16997ba82

View File

@ -295,7 +295,8 @@ constructor TFileBrowserController.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
LazarusIDE.AddHandlerOnProjectOpened(@DoProjectChanged); LazarusIDE.AddHandlerOnProjectOpened(@DoProjectChanged);
SourceEditorManagerIntf.RegisterChangeEvent(semEditorActivate,@ActiveEditorChanged); if SourceEditorManagerIntf <> nil then
SourceEditorManagerIntf.RegisterChangeEvent(semEditorActivate,@ActiveEditorChanged);
FDirectoriesBeforeFiles:=DefaultDirectoriesBeforeFiles; FDirectoriesBeforeFiles:=DefaultDirectoriesBeforeFiles;
FFilesInTree:=DefaultFilesInTree; FFilesInTree:=DefaultFilesInTree;
ReadConfig; ReadConfig;
@ -303,7 +304,8 @@ end;
destructor TFileBrowserController.Destroy; destructor TFileBrowserController.Destroy;
begin begin
LazarusIDE.RemoveAllHandlersOfObject(Self); if SourceEditorManagerIntf <> nil then
SourceEditorManagerIntf.UnRegisterChangeEvent(semEditorActivate,@ActiveEditorChanged);
if FNeedSave then if FNeedSave then
WriteConfig; WriteConfig;
inherited; inherited;