Disconnect bookmark folder signals, for bookmarkbar and panel

This would lead to crashes when opening and closing windows and
attempting to add bookmarks afterwards.
This commit is contained in:
Christian Dywan 2009-08-19 23:51:59 +02:00
parent b77fdd45cf
commit 0da785e94c
2 changed files with 16 additions and 0 deletions

View file

@ -175,6 +175,10 @@ midori_browser_settings_notify (MidoriWebSettings* web_settings,
GParamSpec* pspec, GParamSpec* pspec,
MidoriBrowser* browser); MidoriBrowser* browser);
static void
midori_browser_set_bookmarks (MidoriBrowser* browser,
KatzeArray* bookmarks);
static GtkAction* static GtkAction*
_action_by_name (MidoriBrowser* browser, _action_by_name (MidoriBrowser* browser,
const gchar* name) const gchar* name)
@ -4512,6 +4516,9 @@ midori_browser_size_allocate_cb (MidoriBrowser* browser,
static void static void
midori_browser_destroy_cb (MidoriBrowser* browser) midori_browser_destroy_cb (MidoriBrowser* browser)
{ {
if (browser->bookmarks)
midori_browser_set_bookmarks (browser, NULL);
if (G_UNLIKELY (browser->panel_timeout)) if (G_UNLIKELY (browser->panel_timeout))
g_source_remove (browser->panel_timeout); g_source_remove (browser->panel_timeout);
if (G_UNLIKELY (browser->alloc_timeout)) if (G_UNLIKELY (browser->alloc_timeout))
@ -5706,6 +5713,14 @@ midori_browser_set_bookmarks (MidoriBrowser* browser,
if (browser->bookmarks == bookmarks) if (browser->bookmarks == bookmarks)
return; return;
if (browser->bookmarks)
{
g_signal_handlers_disconnect_by_func (
browser->bookmarks, browser_bookmarks_add_item_cb, browser->bookmarkbar);
g_signal_handlers_disconnect_by_func (
browser->bookmarks, browser_bookmarks_remove_item_cb, browser->bookmarkbar);
}
if (bookmarks) if (bookmarks)
g_object_ref (bookmarks); g_object_ref (bookmarks);
katze_object_assign (browser->bookmarks, bookmarks); katze_object_assign (browser->bookmarks, bookmarks);

View file

@ -935,6 +935,7 @@ midori_bookmarks_finalize (GObject* object)
{ {
MidoriBookmarks* bookmarks = MIDORI_BOOKMARKS (object); MidoriBookmarks* bookmarks = MIDORI_BOOKMARKS (object);
midori_bookmarks_disconnect_folder (bookmarks, bookmarks->array);
if (bookmarks->app) if (bookmarks->app)
g_object_unref (bookmarks->app); g_object_unref (bookmarks->app);
g_object_unref (bookmarks->net); g_object_unref (bookmarks->net);