summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-04-14 13:27:14 +0100
committerBastien Nocera <hadess@hadess.net>2010-04-14 13:38:41 +0100
commit24c12eb129fc66f3578f4b1317bc528640e522a1 (patch)
treeaee676219c91c1a5dcec561b96015f2f6fc00db1
parent7687ebf72c3b17c971d6eea5ec898f6bc096d596 (diff)
downloadtotem-24c12eb129fc66f3578f4b1317bc528640e522a1.tar.gz
Avoid crashes on exit
When the plugin viewer is set to exit, we don't want to receive messages on the bus, or we might crash. Just close the D-Bus connection before showing the error message.
-rw-r--r--browser-plugin/totem-plugin-viewer.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 331b40fa1..64c13387e 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -102,6 +102,7 @@ typedef struct {
typedef struct _TotemEmbedded {
GObject parent;
+ DBusGConnection *conn;
GtkWidget *window;
GtkBuilder *menuxml, *xml;
GtkWidget *about;
@@ -288,6 +289,12 @@ totem_embedded_exit (TotemEmbedded *emb)
static void
totem_embedded_error_and_exit (char *title, char *reason, TotemEmbedded *emb)
{
+ /* Avoid any more contacts, so drop off the bus */
+ if (emb->conn != NULL) {
+ dbus_g_connection_unregister_g_object(emb->conn, G_OBJECT (emb));
+ emb->conn = NULL;
+ }
+
/* FIXME send a signal to the plugin with the error message instead! */
totem_interface_error_blocking (title, reason,
GTK_WINDOW (emb->window));
@@ -2390,8 +2397,10 @@ int main (int argc, char **argv)
emb->referrer_uri = arg_referrer;
/* FIXME: register this BEFORE requesting the service name? */
- dbus_g_connection_register_g_object
- (conn, TOTEM_PLUGIN_VIEWER_DBUS_PATH, G_OBJECT (emb));
+ dbus_g_connection_register_g_object (conn,
+ TOTEM_PLUGIN_VIEWER_DBUS_PATH,
+ G_OBJECT (emb));
+ emb->conn = conn;
/* If we're hidden, construct a hidden window;
* else wait to be plugged in.