From 331c2ad06c24a2a037e9495122ea5a2410c83ece Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Wed, 18 Jun 2014 12:53:17 -0400 Subject: [PATCH 1/1] documentor; compiler/libec: Fixed crashes opening libraries - Since daa244a0463d1dd97a42826cb44ff05278caf323 menus were getting messed up and Documentor would crash on exit after opening an ecere.dll/.so --- compiler/libec/src/loadSymbols.ec | 9 ++++++++- documentor/src/Documentor.ec | 11 ++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/compiler/libec/src/loadSymbols.ec b/compiler/libec/src/loadSymbols.ec index e313f96..bb53b13 100644 --- a/compiler/libec/src/loadSymbols.ec +++ b/compiler/libec/src/loadSymbols.ec @@ -36,6 +36,8 @@ bool inPreCompiler = false; public void SetInPreCompiler(bool b) {inPreCompiler = b; } bool inSymbolGen = false; public void SetInSymbolGen(bool b) {inSymbolGen = b; } +bool inDocumentor = false; +public void SetInDocumentor(bool b) { inDocumentor = b; } OldList * precompDefines; public void SetPrecompDefines(OldList * list) { precompDefines = list; } @@ -784,7 +786,12 @@ public void ImportModule(const char * name, ImportType importType, AccessMode im // Load an extra instance of any shared module to ensure freeing up a // module loaded in another file will not invalidate our objects. - if(!inCompiler && !inPreCompiler && !inSymbolGen) + + // Don't do this for Documentor, because files are loaded with full paths + // and won't be recognized as the same libecere that Documentor is actually using, + // and since this is loaded from the Documentor app module, it will invalidate classes in use. + // We only load one component app at a time for Documentor, so we do not need this trick. + if(!inCompiler && !inPreCompiler && !inSymbolGen && !inDocumentor) { MapIterator > it { map = loadedModules }; if(!it.Index(name /*file*/, false)) diff --git a/documentor/src/Documentor.ec b/documentor/src/Documentor.ec index d8c91c4..21959e3 100644 --- a/documentor/src/Documentor.ec +++ b/documentor/src/Documentor.ec @@ -2237,11 +2237,13 @@ class MainForm : Window imports.Free(FreeModuleImport); FreeGlobalData(globalData); - FreeTypeData(componentsApp); FreeIncludeFiles(); - delete componentsApp; + if(componentsApp) + { + FreeTypeData(componentsApp); + delete componentsApp; + } - SetGlobalContext(globalContext); componentsApp = __ecere_COM_Initialize(false, 1, null); SetPrivateModule(componentsApp); @@ -3863,12 +3865,11 @@ class Documentor : GuiApplication bool Init() { Platform os = __runtimePlatform; - componentsApp = __ecere_COM_Initialize(false, 1, null); - SetPrivateModule(componentsApp); SetGlobalContext(globalContext); SetExcludedSymbols(&excludedSymbols); SetDefines(&::defines); SetImports(&imports); + SetInDocumentor(true); SetGlobalData(globalData); -- 1.8.3.1