* Fixes NB#91414, fixes a memory leak
[modest] / src / modest-singletons.c
index 1883f20..8b9ed7d 100644 (file)
 #include "modest-runtime.h"
 #include "modest-defs.h"
 #include "modest-debug.h"
+#ifdef MODEST_TOOLKIT_HILDON2
+#include "hildon2/modest-hildon2-window-mgr.h"
+#else
+#include "widgets/modest-hildon1-window-mgr.h"
+#endif
 #include <tny-fs-stream-cache.h>
 
 /* 'private'/'protected' functions */
@@ -162,7 +167,11 @@ modest_singletons_init (ModestSingletons *obj)
                return;
        }
 
-       priv->window_mgr = modest_window_mgr_new ();
+#if MODEST_TOOLKIT_HILDON2
+       priv->window_mgr = modest_hildon2_window_mgr_new ();
+#else
+       priv->window_mgr = modest_hildon1_window_mgr_new ();
+#endif
        if (!priv->window_mgr) {
                g_printerr ("modest: cannot create modest window manager instance\n");
                return;
@@ -233,6 +242,12 @@ modest_singletons_finalize (GObject *obj)
                priv->email_clipboard = NULL;
        }
 
+       if (priv->plugin_factory) {
+               MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->plugin_factory,"");
+               g_object_unref (G_OBJECT(priv->plugin_factory));
+               priv->plugin_factory = NULL;
+       }
+
        /* It is important that the account manager is uninitialized after
         * the mail op queue is uninitialized because the mail op queue
         * cancells any mail operations which in turn access the account