[mojosetup] [2/3] Don't crash when unloading unneeded GUI plugins.
    Francois Gouget 
    fgouget at codeweavers.com
       
    Mon Aug 10 13:38:31 EDT 2020
    
    
  
The plugin's entry point table is a static variable in the .so library
which means pointers to it are no longer valid once the library has
been dlclosed(). So reset the gui pointer to make sure
deleteGuiPlugin() does not try to call gui->deinit().
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 gui.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/gui.c b/gui.c
index 523c6a0..8feda49 100644
--- a/gui.c
+++ b/gui.c
@@ -109,6 +109,7 @@ static PluginList *initGuiPluginsByPriority(PluginList *plugins)
             {
                 MojoPlatform_dlclose(i->lib);
                 i->lib = NULL;
+                i->gui = NULL;
             } // if
         } // for
     } // for
@@ -191,6 +192,7 @@ static boolean loadDynamicGuiPlugin(PluginList *plugins, MojoArchive *ar)
                 // always close, because GTK+2 and GTK+3 can't coexist.
                 //  we'll reload them when trying them!
                 MojoPlatform_dlclose(lib);
+                plug->gui = NULL;
             } // if
         } // if
 
-- 
2.20.1
    
    
More information about the mojosetup
mailing list