Update of /cvsroot/mahogany/M/src/classes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21412/src/classes

Modified Files:
        MModule.cpp 
Log Message:
don't use application profile if it's not created yet (as may happen when this 
code is used during config sources initialization)

Index: MModule.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/MModule.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -b -u -2 -r1.96 -r1.97
--- MModule.cpp 16 Jan 2006 20:32:27 -0000      1.96
+++ MModule.cpp 12 Feb 2006 22:36:40 -0000      1.97
@@ -49,10 +49,4 @@
 
 // ----------------------------------------------------------------------------
-// options we use here
-// ----------------------------------------------------------------------------
-
-extern const MOption MP_MODULES_DONT_LOAD;
-
-// ----------------------------------------------------------------------------
 // function prototypes
 // ----------------------------------------------------------------------------
@@ -65,4 +59,22 @@
 #endif // USE_MODULES_STATIC
 
+// return the list of blacklisted modules, i.e. the modules which we shouldn't
+// load even if they're present
+static wxArrayString GetBlacklistedModules()
+{
+   String modulesDontLoad;
+
+   // be careful: we can be called from ConfigSources initialization code,
+   // before the app profile is created
+   if ( mApplication && mApplication->GetProfile() )
+   {
+      extern const MOption MP_MODULES_DONT_LOAD;
+
+      modulesDontLoad = READ_APPCONFIG_TEXT(MP_MODULES_DONT_LOAD);
+   }
+
+   return strutil_restore_array(modulesDontLoad);
+}
+
 // ----------------------------------------------------------------------------
 // constants
@@ -506,5 +518,5 @@
 {
 #ifdef USE_MODULES_STATIC
-   wxArrayString modulesNot;
+   wxArrayString modulesBlacklist;
 
    // only exclude modules to ignore if we're looking for modules implementing
@@ -512,11 +524,10 @@
    if ( listall && !interfaceName.empty() )
    {
-      const String modulesDontLoad = READ_APPCONFIG(MP_MODULES_DONT_LOAD);
-      modulesNot = strutil_restore_array(modulesDontLoad);
+      modulesBlacklist = GetBlacklistedModules();
    }
-#else
+#else // dynamic modules
    // this function only works for loaded modules in dynamic case
    ASSERT_MSG( !listall, _T("this mode is not supported with dynamic modules") 
);
-#endif // USE_MODULES_STATIC
+#endif // USE_MODULES_STATIC/!USE_MODULES_STATIC
 
    MModuleListingImpl *listing =
@@ -537,5 +548,5 @@
       {
          // also ignore the modules excluded by user
-         if ( !listall || modulesNot.Index(me->m_Name) == wxNOT_FOUND )
+         if ( !listall || modulesBlacklist.Index(me->m_Name) == wxNOT_FOUND )
          {
             MModuleListingEntryImpl
@@ -651,6 +662,5 @@
 
    // Second: load list info:
-   const String modulesDontLoad = READ_APPCONFIG(MP_MODULES_DONT_LOAD);
-   const wxArrayString modulesNot = strutil_restore_array(modulesDontLoad);
+   const wxArrayString modulesBlacklist(GetBlacklistedModules());
 
    MModuleListingImpl *listing = MModuleListingImpl::Create(modules.size());
@@ -697,5 +707,5 @@
             // all modules are requested, then return really all of them
             const String name = GetMModuleProperty(props, MMODULE_NAME_PROP);
-            if ( modulesNot.Index(name) != wxNOT_FOUND )
+            if ( modulesBlacklist.Index(name) != wxNOT_FOUND )
             {
                // this module was excluded by user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to