diff --git a/lazproj/coedit.lpi b/lazproj/coedit.lpi
index 37d89fd3..17b52438 100644
--- a/lazproj/coedit.lpi
+++ b/lazproj/coedit.lpi
@@ -526,6 +526,7 @@
+
diff --git a/lazproj/coedit.lpr b/lazproj/coedit.lpr
index f6da8e51..4658c3af 100644
--- a/lazproj/coedit.lpr
+++ b/lazproj/coedit.lpr
@@ -8,7 +8,7 @@ uses
{$ENDIF}{$ENDIF}
Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, anchordockpkg,
ce_sharedres, ce_observer, ce_libman, ce_symstring, ce_tools, ce_dcd, ce_main,
- ce_writableComponent, ce_staticmacro, ce_inspectors, ce_editoroptions, ce_compilers,
+ ce_writableComponent, ce_staticmacro, ce_inspectors, ce_editoroptions,
ce_dockoptions, ce_shortcutseditor, ce_mru, ce_processes,
ce_dialogs, ce_dubprojeditor, ce_controls, ce_dfmt, ce_lcldragdrop,
ce_stringrange, ce_dlangmaps, ce_projgroup, ce_projutils, ce_d2synpresets,
diff --git a/src/ce_lcldragdrop.pas b/src/ce_lcldragdrop.pas
index 684275db..282476b3 100644
--- a/src/ce_lcldragdrop.pas
+++ b/src/ce_lcldragdrop.pas
@@ -31,14 +31,16 @@ type
procedure DragDrop(Sender, Source: TObject; X, Y: Integer);
end;
-var
- ddHandler: TDDHandler;
+function ddHandler: TDDHandler;
implementation
uses
ce_observer;
+var
+ fDdHandler: TDDHandler = nil;
+
constructor TDDHandler.create;
begin
EntitiesConnector.addObserver(self);
@@ -152,11 +154,14 @@ begin
else getMultiDocHandler.openDocument(fname);
end;
-initialization
- ddHandler:= TDDHandler.create;
+function ddHandler: TDDHandler;
+begin
+ if fDdHandler.isNil then
+ fDdHandler:= TDDHandler.create;
+ result := fDdHandler;
+end;
finalization
ddHandler.free;
-
end.
diff --git a/src/ce_libman.pas b/src/ce_libman.pas
index 97601e91..c54bd9bf 100644
--- a/src/ce_libman.pas
+++ b/src/ce_libman.pas
@@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, FileUtil, ce_common, ce_writableComponent, LazFileUtils,
ghashmap, ghashset,
- ce_dcd, ce_dialogs, ce_projutils, ce_interfaces, ce_dlang, ce_dastworx,
+ ce_dcd, ce_projutils, ce_interfaces, ce_dlang, ce_dastworx,
ce_compilers;
type
@@ -135,11 +135,13 @@ type
const
libFname = 'libraryManager.txt';
-var
- LibMan: TLibraryManager;
+function LibMan: TLibraryManager;
implementation
+var
+ fLibMan: TLibraryManager = nil;
+
const
deactivatedMessage = 'Library item "%s" could be detected but it is marked disabled, ' +
'the compilation will fail.';
@@ -663,9 +665,13 @@ begin
end;
end;
-initialization
- registerClasses([TLibraryManager, TLibraryItem]);
- LibMan := TLibraryManager.create(nil);
+function LibMan: TLibraryManager;
+begin
+ if fLibMan.isNil then
+ fLibMan := TLibraryManager.create(nil);
+ result := fLibMan;
+end;
+
finalization
- LibMan.Free;
+ fLibMan.Free;
end.