Re: [evolution-patches] Bonobo Ref Counting Patches
- From: JP Rosevear <jpr ximian com>
- To: Not Zed <notzed ximian com>
- Cc: evolution-patches ximian com
- Subject: Re: [evolution-patches] Bonobo Ref Counting Patches
- Date: 14 May 2003 07:15:26 -0400
On Wed, 2003-05-14 at 03:15, Not Zed wrote:
> spoke too soon ;)
>
> You need to add a
>
> #include <bonobo/bonobo-exception.h>
>
> to mail-display.c, otherwise mail vanishes when it tries to resolve the
> unknown symbol BONOBO_EX.
Hmm, not sure why I'm not seeing this - fixed in attached updated mail
patch.
> Otherwise - it doesn't fix up 40989 afterall :-/ The folderbrowser is
> still hanging around with a single refcount. "oh well".
Actually I found an additional problem where if you switched folders
only the final folder shown would be finalized. Updated shell patch
attached (one liner freeing the current shell view interface in
setup_corba_interface).
-JP
--
JP Rosevear <jpr ximian com>
Ximian, Inc.
? bonobo-ref.patch
? ui.txt
? ui2.txt
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2721
diff -u -r1.2721 ChangeLog
--- ChangeLog 9 May 2003 17:11:08 -0000 1.2721
+++ ChangeLog 14 May 2003 11:12:11 -0000
@@ -1,3 +1,26 @@
+2003-05-13 JP Rosevear <jpr ximian com>
+
+ * mail-local.h: add proto
+
+ * mail-local.c (storage_listener_startup): don't listen for
+ destruction, because we have a ref and it'll never happen
+ (mail_local_storage_shutdown): release and unref the local storage
+
+ * mail-display.c (retrieve_shell_view_interface_from_control):
+ return a new copy every time
+ (set_status_message): release and unref the shell view
+
+ * folder-browser.c (folder_browser_destroy): guard for multiple
+ destroys
+
+ * folder-browser-factory.c (control_activate): release and unref
+ the shell view
+ (control_destroy_cb): just remove the control from the list
+ (folder_browser_factory_new_control): don't weak ref the folder
+ browser
+
+ * component-factory.c (owner_unset_cb): shutdown local storage
+
2003-05-08 Ettore Perazzoli <ettore ximian com>
* mail-session.c (mail_session_set_interactive): Set the
Index: component-factory.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/component-factory.c,v
retrieving revision 1.322
diff -u -r1.322 component-factory.c
--- component-factory.c 7 Apr 2003 01:45:08 -0000 1.322
+++ component-factory.c 14 May 2003 11:12:11 -0000
@@ -925,6 +925,7 @@
empty_trash (NULL, NULL, NULL);
unref_standard_folders ();
+ mail_local_storage_shutdown ();
mail_importer_uninit ();
global_shell_client = NULL;
Index: folder-browser-factory.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/folder-browser-factory.c,v
retrieving revision 1.201
diff -u -r1.201 folder-browser-factory.c
--- folder-browser-factory.c 26 Mar 2003 21:24:45 -0000 1.201
+++ folder-browser-factory.c 14 May 2003 11:12:11 -0000
@@ -91,6 +91,7 @@
{
GtkWidget *folder_browser;
Bonobo_UIContainer container;
+ GNOME_Evolution_ShellView svi;
container = bonobo_control_get_remote_ui_container (control, NULL);
bonobo_ui_component_set_container (uic, container, NULL);
@@ -110,7 +111,9 @@
/*bonobo_ui_component_thaw (uic, NULL);*/
- folder_browser_set_shell_view (fb, fb_get_svi (control));
+ svi = fb_get_svi (control);
+ folder_browser_set_shell_view (fb, svi);
+ bonobo_object_release_unref (svi, NULL);
folder_browser_reload (fb);
@@ -158,32 +161,9 @@
}
static void
-control_destroy_cb (GtkObject *fb, GObject *deadbeef)
+control_destroy_cb (GtkObject *fb, GObject *control)
{
- gtk_object_destroy (fb);
-}
-
-static void
-browser_destroy_cb (BonoboControl *control, GObject *deadbeef)
-{
- EIterator *it;
-
- /* We do this from browser_destroy_cb rather than
- * control_destroy_cb because currently, the controls
- * don't seem to all get destroyed properly at quit
- * time (but the widgets get destroyed by X). FIXME.
- */
-
- it = e_list_get_iterator (control_list);
- while (e_iterator_is_valid (it)) {
- if (e_iterator_get (it) == control) {
- e_iterator_delete (it);
- break;
- }
- e_iterator_next (it);
- }
-
- g_object_unref (it);
+ e_list_remove (control_list, control);
}
BonoboControl *
@@ -210,7 +190,6 @@
g_signal_connect (control, "activate", G_CALLBACK (control_activate_cb), fb);
g_object_weak_ref (G_OBJECT(control), (GWeakNotify) control_destroy_cb, fb);
- g_object_weak_ref (G_OBJECT(fb), (GWeakNotify) browser_destroy_cb, control);
if (!control_list)
control_list = e_list_new (NULL, NULL, NULL);
Index: folder-browser.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/folder-browser.c,v
retrieving revision 1.343
diff -u -r1.343 folder-browser.c
--- folder-browser.c 2 May 2003 16:07:17 -0000 1.343
+++ folder-browser.c 14 May 2003 11:12:12 -0000
@@ -199,8 +199,11 @@
}
/* wait for all outstanding async events against us */
- mail_async_event_destroy (folder_browser->async_event);
-
+ if (folder_browser->async_event) {
+ mail_async_event_destroy (folder_browser->async_event);
+ folder_browser->async_event = NULL;
+ }
+
if (folder_browser->search_full) {
g_object_unref (folder_browser->search_full);
folder_browser->search_full = NULL;
Index: mail-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-display.c,v
retrieving revision 1.276
diff -u -r1.276 mail-display.c
--- mail-display.c 8 May 2003 17:01:55 -0000 1.276
+++ mail-display.c 14 May 2003 11:12:13 -0000
@@ -44,6 +44,7 @@
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnome/gnome-url.h>
+#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-control-frame.h>
#include <bonobo/bonobo-stream-memory.h>
#include <bonobo/bonobo-widget.h>
@@ -2570,14 +2571,11 @@
shell_view_interface = Bonobo_Unknown_queryInterface (control_frame,
"IDL:GNOME/Evolution/ShellView:1.0",
&ev);
- CORBA_exception_free (&ev);
+
+ if (BONOBO_EX (&ev))
+ shell_view_interface = CORBA_OBJECT_NIL;
- if (shell_view_interface != CORBA_OBJECT_NIL)
- g_object_set_data ((GObject *) control,
- "mail_threads_shell_view_interface",
- shell_view_interface);
- else
- g_warning ("Control frame doesn't have Evolution/ShellView.");
+ CORBA_exception_free (&ev);
return shell_view_interface;
}
@@ -2596,10 +2594,7 @@
control = BONOBO_CONTROL (e_iterator_get (it));
- shell_view_interface = g_object_get_data ((GObject *) control, "mail_threads_shell_view_interface");
-
- if (shell_view_interface == CORBA_OBJECT_NIL)
- shell_view_interface = retrieve_shell_view_interface_from_control (control);
+ shell_view_interface = retrieve_shell_view_interface_from_control (control);
CORBA_exception_init (&ev);
@@ -2612,6 +2607,8 @@
}
CORBA_exception_free (&ev);
+
+ bonobo_object_release_unref (shell_view_interface, NULL);
/* yeah we only set the first one. Why? Because it seems to leave
random ones lying around otherwise. Shrug. */
Index: mail-local.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-local.c,v
retrieving revision 1.130
diff -u -r1.130 mail-local.c
--- mail-local.c 25 Mar 2003 15:49:19 -0000 1.130
+++ mail-local.c 14 May 2003 11:12:14 -0000
@@ -1143,18 +1143,6 @@
/* ** Local Storage Listener ****************************************************** */
static void
-local_storage_destroyed_cb (EvolutionStorageListener *storage_listener,
- void *data)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (data, &ev);
- CORBA_exception_free (&ev);
-}
-
-
-static void
local_storage_new_folder_cb (EvolutionStorageListener *storage_listener,
const char *path,
const GNOME_Evolution_Folder *folder,
@@ -1232,11 +1220,6 @@
corba_local_storage_listener = evolution_storage_listener_corba_objref (
local_storage_listener);
- /* FIXME: is this supposed to be destroy? */
- g_signal_connect(local_storage_listener,
- "destroyed",
- G_CALLBACK (local_storage_destroyed_cb),
- corba_storage);
g_signal_connect(local_storage_listener,
"new_folder",
G_CALLBACK (local_storage_new_folder_cb),
@@ -1272,6 +1255,13 @@
}
storage_listener_startup (shellclient);
+}
+
+void
+mail_local_storage_shutdown (void)
+{
+ bonobo_object_release_unref (local_corba_storage, NULL);
+ local_corba_storage = CORBA_OBJECT_NIL;
}
Index: mail-local.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-local.h,v
retrieving revision 1.12
diff -u -r1.12 mail-local.h
--- mail-local.h 11 Sep 2002 04:27:23 -0000 1.12
+++ mail-local.h 14 May 2003 11:12:14 -0000
@@ -30,6 +30,7 @@
#include <camel/camel-folder.h>
void mail_local_storage_startup (EvolutionShellClient *shellclient, const char *evolution_path);
+void mail_local_storage_shutdown (void);
void mail_local_reconfigure_folder(const char *uri, void (*done)(const char *uri, CamelFolder *folder, void *data), void *done_data);
? bonobo-ref.patch
? old.txt
? old2.txt
? old3.txt
? ref.txt
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1271
diff -u -r1.1271 ChangeLog
--- ChangeLog 9 May 2003 15:00:46 -0000 1.1271
+++ ChangeLog 14 May 2003 11:08:41 -0000
@@ -1,3 +1,25 @@
+2003-05-13 JP Rosevear <jpr ximian com>
+
+ * e-shell.c (save_settings_for_component): release the interface
+ if we got it
+
+ * e-shell-view.c: include bonobo-exception.h
+ (impl_dispose): release and unref the shell view corba interface
+ (init): init to CORBA_OBJECT_NIL
+ (e_shell_view_get_corba_interface): return the corba interface
+ (setup_corba_interface): release the existing shell view, add as
+ an interface and then query to get it back
+ (get_view_for_uri): release and unref the control once we create
+ the widget with it
+
+ * e-corba-storage.c (storage_listener_servant_new): don't ref ourselves
+ (storage_listener_servant_free): don't unref ourselves
+ (impl_dispose): free the servant info
+
+ * e-corba-storage-registry.c
+ (impl_StorageRegistry_getStorageByName): we need to ref as well as
+ duplicate since we didn't create the storage here
+
2003-05-09 Jeremy Katz <katzj redhat com>
* main.c: Add a #include to fix a warning.
Index: e-corba-storage-registry.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-corba-storage-registry.c,v
retrieving revision 1.30
diff -u -r1.30 e-corba-storage-registry.c
--- e-corba-storage-registry.c 13 Jan 2003 18:51:36 -0000 1.30
+++ e-corba-storage-registry.c 14 May 2003 11:08:41 -0000
@@ -193,10 +193,9 @@
return CORBA_OBJECT_NIL;
}
- corba_storage = CORBA_Object_duplicate (e_corba_storage_get_corba_objref
- (E_CORBA_STORAGE (storage)), ev);
+ corba_storage = e_corba_storage_get_corba_objref (E_CORBA_STORAGE (storage));
- return corba_storage;
+ return bonobo_object_dup_ref (corba_storage, NULL);
}
static void
Index: e-corba-storage.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-corba-storage.c,v
retrieving revision 1.56
diff -u -r1.56 e-corba-storage.c
--- e-corba-storage.c 25 Apr 2003 17:03:51 -0000 1.56
+++ e-corba-storage.c 14 May 2003 11:08:42 -0000
@@ -77,7 +77,6 @@
servant->servant.vepv = &storage_listener_vepv;
- g_object_ref (corba_storage);
servant->storage = E_STORAGE (corba_storage);
return servant;
@@ -86,8 +85,6 @@
static void
storage_listener_servant_free (StorageListenerServant *servant)
{
- g_object_unref (servant->storage);
-
g_free (servant);
}
@@ -272,6 +269,7 @@
CORBA_free (object_id);
+ storage_listener_servant_free (priv->storage_listener_servant);
priv->storage_listener_servant = NULL;
}
Index: e-shell-user-creatable-items-handler.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-user-creatable-items-handler.c,v
retrieving revision 1.27
diff -u -r1.27 e-shell-user-creatable-items-handler.c
--- e-shell-user-creatable-items-handler.c 15 Apr 2003 21:27:08 -0000 1.27
+++ e-shell-user-creatable-items-handler.c 14 May 2003 11:08:42 -0000
@@ -598,6 +598,8 @@
bonobo_ui_component_object_set (ui_component, "/Toolbar/NewComboButton",
BONOBO_OBJREF (control), NULL);
+ bonobo_object_unref (control);
+
g_object_set_data (G_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY, combo_button);
tooltips = gtk_tooltips_new ();
@@ -679,6 +681,7 @@
g_slist_free (priv->components);
priv->components = NULL;
+
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
Index: e-shell-view.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-view.c,v
retrieving revision 1.283
diff -u -r1.283 e-shell-view.c
--- e-shell-view.c 8 May 2003 21:54:58 -0000 1.283
+++ e-shell-view.c 14 May 2003 11:08:43 -0000
@@ -66,6 +66,7 @@
#include <gtk/gtkscrolledwindow.h>
#include <gconf/gconf-client.h>
+#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-socket.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-ui-container.h>
@@ -91,7 +92,7 @@
/* EvolutionShellView Bonobo object for implementing the
Evolution::ShellView interface. */
- EvolutionShellView *corba_interface;
+ GNOME_Evolution_ShellView corba_interface;
/* The UI handler & container. */
BonoboUIComponent *ui_component;
@@ -1464,9 +1465,9 @@
priv->shell = NULL;
}
- if (priv->corba_interface != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (priv->corba_interface));
- priv->corba_interface = NULL;
+ if (priv->corba_interface != CORBA_OBJECT_NIL) {
+ bonobo_object_release_unref (priv->corba_interface, NULL);
+ priv->corba_interface = CORBA_OBJECT_NIL;
}
if (priv->folder_bar_popup != NULL) {
@@ -1582,7 +1583,7 @@
priv = g_new (EShellViewPrivate, 1);
priv->shell = NULL;
- priv->corba_interface = NULL;
+ priv->corba_interface = CORBA_OBJECT_NIL;
priv->ui_component = NULL;
priv->history = e_history_new ((EHistoryItemFreeFunc) g_free);
priv->uri = NULL;
@@ -1900,7 +1901,7 @@
priv = shell_view->priv;
- return bonobo_object_corba_objref (BONOBO_OBJECT (priv->corba_interface));
+ return priv->corba_interface;
}
@@ -2167,7 +2168,8 @@
EShellViewPrivate *priv;
BonoboControlFrame *control_frame;
EvolutionShellView *corba_interface;
-
+ CORBA_Environment ev;
+
g_return_if_fail (control != NULL);
priv = shell_view->priv;
@@ -2191,8 +2193,18 @@
bonobo_object_add_interface (BONOBO_OBJECT (control_frame),
BONOBO_OBJECT (corba_interface));
- bonobo_object_ref (BONOBO_OBJECT (corba_interface));
- priv->corba_interface = corba_interface;
+
+ /* Get rid of the existing one first */
+ bonobo_object_release_unref (priv->corba_interface, NULL);
+
+ /* Now find the existing one */
+ CORBA_exception_init (&ev);
+ priv->corba_interface = Bonobo_Unknown_queryInterface (BONOBO_OBJREF (control_frame),
+ "IDL:GNOME/Evolution/ShellView:1.0",
+ &ev);
+ if (BONOBO_EX (&ev))
+ priv->corba_interface = CORBA_OBJECT_NIL;
+ CORBA_exception_free (&ev);
}
@@ -2339,6 +2351,7 @@
container = bonobo_ui_component_get_container (priv->ui_component);
control = bonobo_widget_new_control_from_objref (corba_control, container);
+ bonobo_object_release_unref (corba_control, NULL);
socket = find_socket (GTK_CONTAINER (control));
destroy_connection_id = g_signal_connect (socket, "destroy",
Index: e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.213
diff -u -r1.213 e-shell.c
--- e-shell.c 15 Apr 2003 21:27:08 -0000 1.213
+++ e-shell.c 14 May 2003 11:08:43 -0000
@@ -1630,6 +1630,9 @@
g_free (prefix);
+ if (retval)
+ bonobo_object_release_unref (session_interface, NULL);
+
CORBA_exception_free (&ev);
return retval;
Index: main.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/main.c,v
retrieving revision 1.121
diff -u -r1.121 main.c
--- main.c 9 May 2003 15:00:46 -0000 1.121
+++ main.c 14 May 2003 11:08:44 -0000
@@ -627,5 +627,7 @@
bonobo_main ();
+ bonobo_debug_shutdown ();
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]