diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-10-29 21:56:51 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-10-29 21:56:51 +0800 |
commit | c6494847b87a4fbd7d1409f5a7b717a125745466 (patch) | |
tree | 0d2b2b0271578850dde2071ed43b2240ae657702 /src | |
parent | e76ce986941f3f95b3d35b23b77a0434991975f4 (diff) | |
download | gsoc2013-empathy-c6494847b87a4fbd7d1409f5a7b717a125745466.tar gsoc2013-empathy-c6494847b87a4fbd7d1409f5a7b717a125745466.tar.gz gsoc2013-empathy-c6494847b87a4fbd7d1409f5a7b717a125745466.tar.bz2 gsoc2013-empathy-c6494847b87a4fbd7d1409f5a7b717a125745466.tar.lz gsoc2013-empathy-c6494847b87a4fbd7d1409f5a7b717a125745466.tar.xz gsoc2013-empathy-c6494847b87a4fbd7d1409f5a7b717a125745466.tar.zst gsoc2013-empathy-c6494847b87a4fbd7d1409f5a7b717a125745466.zip |
empathy-accounts-dialog: do_constructor: always return a new reference
This fix is cleaner than the previous commmit. The constructor now
always returns a new reference to the caller. It also now has an extra
reference that it will release once the dialog as been destroyed.
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-accounts-dialog.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 5829ff8d0..e877e632f 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -1762,9 +1762,7 @@ do_constructor (GType type, if (dialog_singleton) { retval = G_OBJECT (dialog_singleton); - /* We don't ref the object as the caller is not suppose to unref it. - * The dialog is unreffed in accounts_dialog_destroy_cb when the window - * has been destroyed. */ + g_object_ref (retval); } else { @@ -1774,6 +1772,9 @@ do_constructor (GType type, dialog_singleton = EMPATHY_ACCOUNTS_DIALOG (retval); g_object_add_weak_pointer (retval, (gpointer) &dialog_singleton); + /* We add an extra reference that we'll release when the dialog is + * destroyed (accounts_dialog_destroy_cb) */ + g_object_ref (retval); } return retval; @@ -1912,6 +1913,9 @@ empathy_accounts_dialog_show (GtkWindow *parent, } gtk_window_present (GTK_WINDOW (priv->window)); + /* EmpathyAccountsDialog kepts a ref on itself until the dialog is + * destroyed so we can release the ref returned by the constructor now. */ + g_object_unref (dialog); return priv->window; } |