[gegl] meta-json: Force module to be persistent



commit 08c4063702aaecbb9b777706e7b469a3b171b877
Author: Jon Nordby <jononor gmail com>
Date:   Sat Jan 24 13:45:39 2015 -0500

    meta-json: Force module to be persistent
    
    Hopefully fixes segfault in some cases where libgegl/executable
    does not link json-glib, and the shared lib which GType database
    referred to was unloaded.
    https://bugzilla.gnome.org/show_bug.cgi?id=743296

 operations/core/json.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/operations/core/json.c b/operations/core/json.c
index 911dde0..759227d 100644
--- a/operations/core/json.c
+++ b/operations/core/json.c
@@ -41,6 +41,8 @@ dropshadow a good initial testcase?
 // For module paths
 #include <gegl-init-private.h>
 #include <gegldatafiles.h>
+/* For forcing module to be persistent */
+#include <geglmodule.h>
 
 /* JsonOp: Meta-operation base class for ops defined by .json file */
 #include <operation/gegl-operation-meta-json.h>
@@ -605,6 +607,11 @@ gegl_module_query (GTypeModule *module)
 G_MODULE_EXPORT gboolean
 gegl_module_register (GTypeModule *module)
 {
+  /* Ensure the module, or shared libs it pulls in is not unloaded
+   * This because when GTypes are registered (like for json-glib),
+   *  all referenced data must stay in memory until process exit */
+  g_module_make_resident (GEGL_MODULE (module)->module);
+
   json_register_operations (module);
 
   return TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]