gnome-terminal r2878 - trunk/src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-terminal r2878 - trunk/src
- Date: Sun, 8 Jun 2008 11:36:47 +0000 (UTC)
Author: chpe
Date: Sun Jun 8 11:36:47 2008
New Revision: 2878
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2878&view=rev
Log:
Don't leak the listener.
Modified:
trunk/src/terminal.c
Modified: trunk/src/terminal.c
==============================================================================
--- trunk/src/terminal.c (original)
+++ trunk/src/terminal.c Sun Jun 8 11:36:47 2008
@@ -72,6 +72,7 @@
static gboolean initialization_complete = FALSE;
static GSList *pending_new_terminal_events = NULL;
static BonoboListener *listener = NULL;
+static gboolean factory_registered = FALSE;
typedef struct
{
@@ -1236,8 +1237,10 @@
terminal_app_shutdown ();
- if (listener)
+ if (factory_registered)
bonobo_activation_active_server_unregister (ACT_IID, BONOBO_OBJREF (listener));
+ if (listener)
+ bonobo_object_unref (BONOBO_OBJECT (listener));
g_object_unref (program);
@@ -1756,8 +1759,14 @@
result = bonobo_activation_active_server_register (
per_display_iid, BONOBO_OBJREF (listener));
- if (result != Bonobo_ACTIVATION_REG_SUCCESS)
- bonobo_object_unref (BONOBO_OBJECT (listener));
+ factory_registered = (result == Bonobo_ACTIVATION_REG_SUCCESS);
+
+ if (!factory_registered)
+ {
+ bonobo_object_unref (BONOBO_OBJECT (listener));
+ listener = NULL;
+ }
+
#ifdef DEBUG_FACTORY
if (result == Bonobo_ACTIVATION_REG_SUCCESS)
@@ -1772,7 +1781,7 @@
static gboolean
terminal_invoke_factory (int argc, char **argv)
{
- Bonobo_Listener listener;
+ Bonobo_Listener receiver;
switch (terminal_register_as_factory ())
{
@@ -1793,10 +1802,10 @@
break;
}
- listener = bonobo_activation_activate_from_id (
+ receiver = bonobo_activation_activate_from_id (
ACT_IID, Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, NULL);
- if (listener != CORBA_OBJECT_NIL)
+ if (receiver != CORBA_OBJECT_NIL)
{
int i;
CORBA_any any;
@@ -1814,8 +1823,8 @@
for (i = 0; i < args._length; i++)
args._buffer [i] = argv [i];
- Bonobo_Listener_event (listener, "new_terminal", &any, &ev);
- CORBA_Object_release (listener, &ev);
+ Bonobo_Listener_event (receiver, "new_terminal", &any, &ev);
+ CORBA_Object_release (receiver, &ev);
if (!BONOBO_EX (&ev))
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]