From c9ccac921537b68b5620b485848094a0ffecc3c1 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Fri, 29 Oct 2004 22:41:05 +0000 Subject: Move idle unreffing to extensions manager. Makes sure that extensions are 2004-10-30 Christian Persch * lib/ephy-shlib-loader.c: (impl_release_object): * src/ephy-extensions-manager.c: (idle_unref), (unload_extension): Move idle unreffing to extensions manager. Makes sure that extensions are finalised. --- ChangeLog | 8 ++++++++ lib/ephy-shlib-loader.c | 15 +-------------- src/ephy-extensions-manager.c | 17 ++++++++++++++++- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7936ea56a..a8c14ec40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-10-30 Christian Persch + + * lib/ephy-shlib-loader.c: (impl_release_object): + * src/ephy-extensions-manager.c: (idle_unref), (unload_extension): + + Move idle unreffing to extensions manager. Makes sure that extensions + are finalised. + 2004-10-29 Adam Hooper * src/ephy-extensions-manager.c: diff --git a/lib/ephy-shlib-loader.c b/lib/ephy-shlib-loader.c index 8c6db15b0..5877ee341 100644 --- a/lib/ephy-shlib-loader.c +++ b/lib/ephy-shlib-loader.c @@ -142,14 +142,6 @@ find_object (const LoaderData *data, return data->object != object; } -static gboolean -idle_unref (GObject *object) -{ - g_object_unref (object); - - return FALSE; -} - static GObject * impl_get_object (EphyLoader *eloader, GData **attributes) @@ -224,12 +216,7 @@ impl_release_object (EphyLoader *eloader, g_return_if_fail (l != NULL); data = l->data; - /* FIXME: should we consider those extensions broken? - * Only unref the extension in the idle loop; if the extension has its - * own functions queued in the idle loop, the functions must exist in - * memory before being called. - */ - g_idle_add ((GSourceFunc) idle_unref, data->object); + g_object_unref (data->object); data->object = NULL; } diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c index 3e79940dc..a940daca4 100644 --- a/src/ephy-extensions-manager.c +++ b/src/ephy-extensions-manager.c @@ -755,6 +755,14 @@ detach_window (EphyWindow *window, ephy_extension_detach_window (extension, window); } +static gboolean +idle_unref (GObject *object) +{ + g_object_unref (object); + + return FALSE; +} + static void unload_extension (EphyExtensionsManager *manager, ExtensionInfo *info) @@ -776,8 +784,15 @@ unload_extension (EphyExtensionsManager *manager, g_list_remove (manager->priv->extensions, info->extension); } + /* we own two refs to the extension, the one we added when + * we added it to the priv->extensions list, and the one returned + * from get_object. Release object, and queue a unref, since if the + * extension has its own functions queued in the idle loop, the + * functions must exist in memory before being called. + */ + g_idle_add ((GSourceFunc) idle_unref, info->extension); + ephy_loader_release_object (info->loader, G_OBJECT (info->extension)); - g_object_unref (info->extension); info->info.active = FALSE; info->extension = NULL; -- cgit v1.2.3