From 55bcddfd18577f6363842ad3b1772e0db9f1c011 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Fri, 10 Jun 2005 21:21:36 +0000 Subject: Common helper function to unref a GObject from idle. 2005-06-10 Christian Persch * lib/Makefile.am: * lib/ephy-object-helpers.c: * lib/ephy-object-helpers.h: Common helper function to unref a GObject from idle. * embed/downloader-view.c: (downloader_view_finalize): * embed/mozilla/mozilla-embed-find.cpp: * embed/mozilla/mozilla-embed-persist.cpp: * embed/mozilla/mozilla-embed.cpp: * src/ephy-extensions-manager.c: (unload_extension): * src/ephy-main.c: (main): * src/ephy-shell.c: (toolwindow_hide_cb): * src/ephy-window.c: (ephy_window_finalize): Always unref the shell from idle, never directly. That's because in case we hold the last reference, we would end up terminating embedding/XPCOM from a mozilla callback. Fixes bug #151037, and moz#236688. --- lib/ephy-object-helpers.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/ephy-object-helpers.c (limited to 'lib/ephy-object-helpers.c') diff --git a/lib/ephy-object-helpers.c b/lib/ephy-object-helpers.c new file mode 100644 index 000000000..6ef398c89 --- /dev/null +++ b/lib/ephy-object-helpers.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2005 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + +#include "config.h" + +#include "ephy-object-helpers.h" + +static gboolean +idle_unref (gpointer object) +{ + g_object_unref (object); + + /* don't run again */ + return FALSE; +} + +void +ephy_object_idle_unref (gpointer object) +{ + g_idle_add ((GSourceFunc) idle_unref, object); +} -- cgit v1.2.3