diff options
author | Darin Adler <darin@src.gnome.org> | 2000-09-06 17:08:09 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-09-06 17:08:09 +0000 |
commit | 307bafbb3ff58a1c927ce89a783d04d01278639c (patch) | |
tree | de18ba9fdf2532834ca4a3ccd86dc2841242cabb /libnautilus | |
parent | c9ec59f155800c722fe95d2269491873b4f28b8a (diff) | |
download | nautilus-307bafbb3ff58a1c927ce89a783d04d01278639c.tar.gz |
Added checks in Nautilus to guarantee we will notice leaks
of UI handlers in the future.
The check will fire unless you get new Bonobo, since I just fixed
a UI handler leak bug in Bonobo.
* src/nautilus-window.c: (nautilus_window_real_set_content_view):
Added code to check for a still-merged Open menu item in the file
menu. This will catch leaks of UI handlers fairly quickly, instead
of the traditional way we discover them, after long debugging
sessions.
* components/history/nautilus-history-view.c:
(history_view_frame_call_end):
* libnautilus-extensions/nautilus-undo-manager.c:
(release_transaction), (nautilus_undo_manager_undo):
* libnautilus/nautilus-clipboard.c: (add_menu_items_callback):
* libnautilus/nautilus-undo.c: (undo_manager_unref_cover),
(nautilus_undo_attach_undo_manager):
* libnautilus/nautilus-view.c: (view_frame_call_end):
* src/file-manager/fm-directory-view.c:
(bonobo_control_activate_callback):
* src/nautilus-application.c: (nautilus_application_startup):
* src/nautilus-view-frame-bonobo-embeddable.c:
(bonobo_subdoc_load_location):
* src/nautilus-view-frame-nautilus-view.c:
(nautilus_view_try_load_client):
* src/nautilus-view-frame.c: (nautilus_view_frame_destroy_client),
(nautilus_view_frame_load_client):
Use bonobo_object_dup_ref and bonobo_object_release_unref to
simplify some code.
* components/loser/content/nautilus-content-loser.c:
(loser_merge_bonobo_items_callback):
* components/loser/sidebar/nautilus-sidebar-loser.c:
(loser_merge_bonobo_items_callback):
* components/mozilla/nautilus-mozilla-content-view.c:
(mozilla_merge_bonobo_items_callback):
* components/sample/nautilus-sample-content-view.c:
(sample_merge_bonobo_items_callback):
Add missing unref to avoid leaking a UI handler.
* components/services/time/nautilus-view/trilobite-eazel-time-view.c:
Remove a bunch of code inside #if 0, which had out of date copies
of the sample code. I decided this was better than trying to fix
it.
Diffstat (limited to 'libnautilus')
-rw-r--r-- | libnautilus/nautilus-clipboard.c | 7 | ||||
-rw-r--r-- | libnautilus/nautilus-undo.c | 30 | ||||
-rw-r--r-- | libnautilus/nautilus-view.c | 3 |
3 files changed, 5 insertions, 35 deletions
diff --git a/libnautilus/nautilus-clipboard.c b/libnautilus/nautilus-clipboard.c index edbe89dc1..e548598d1 100644 --- a/libnautilus/nautilus-clipboard.c +++ b/libnautilus/nautilus-clipboard.c @@ -101,19 +101,14 @@ add_menu_items_callback (GtkWidget *widget, { BonoboUIHandler *local_ui_handler; Bonobo_UIHandler remote_ui_handler; - CORBA_Environment ev; g_assert (GTK_IS_EDITABLE (widget)); local_ui_handler = bonobo_control_get_ui_handler (BONOBO_CONTROL (callback_data)); - /* I wish I understood better why we have to do this. */ - CORBA_exception_init (&ev); remote_ui_handler = bonobo_control_get_remote_ui_handler (BONOBO_CONTROL (callback_data)); bonobo_ui_handler_set_container (local_ui_handler, remote_ui_handler); - Bonobo_UIHandler_unref (remote_ui_handler, &ev); - CORBA_Object_release (remote_ui_handler, &ev); - CORBA_exception_free (&ev); + bonobo_object_release_unref (remote_ui_handler, NULL); /* FIXME bugzilla.eazel.com 733: We never mark any of these items insensitive. */ add_menu_item (local_ui_handler, diff --git a/libnautilus/nautilus-undo.c b/libnautilus/nautilus-undo.c index eaf7d2bc0..66f3b91bf 100644 --- a/libnautilus/nautilus-undo.c +++ b/libnautilus/nautilus-undo.c @@ -190,35 +190,10 @@ nautilus_undo_get_undo_manager (GtkObject *start_object) return CORBA_OBJECT_NIL; } -static Nautilus_Undo_Manager -undo_manager_ref (Nautilus_Undo_Manager manager) -{ - CORBA_Environment ev; - Nautilus_Undo_Manager result; - - CORBA_exception_init (&ev); - Nautilus_Undo_Manager_ref (manager, &ev); - result = CORBA_Object_duplicate (manager, &ev); - CORBA_exception_free (&ev); - - return result; -} - -static void -undo_manager_unref (Nautilus_Undo_Manager manager) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - Nautilus_Undo_Manager_unref (manager, &ev); - CORBA_Object_release (manager, &ev); - CORBA_exception_free (&ev); -} - static void undo_manager_unref_cover (gpointer manager) { - undo_manager_unref (manager); + bonobo_object_release_unref (manager, NULL); } void @@ -230,9 +205,10 @@ nautilus_undo_attach_undo_manager (GtkObject *object, if (manager == NULL) { gtk_object_remove_data (object, NAUTILUS_UNDO_MANAGER_DATA); } else { + bonobo_object_dup_ref (manager, NULL); gtk_object_set_data_full (object, NAUTILUS_UNDO_MANAGER_DATA, - undo_manager_ref (manager), undo_manager_unref_cover); + manager, undo_manager_unref_cover); } } diff --git a/libnautilus/nautilus-view.c b/libnautilus/nautilus-view.c index 7ec57b9c3..fa898567a 100644 --- a/libnautilus/nautilus-view.c +++ b/libnautilus/nautilus-view.c @@ -313,8 +313,7 @@ view_frame_call_begin (NautilusView *view, CORBA_Environment *ev) static void view_frame_call_end (Nautilus_ViewFrame frame, CORBA_Environment *ev) { - Nautilus_ViewFrame_unref (frame, ev); - CORBA_Object_release (frame, ev); + bonobo_object_release_unref (frame, ev); CORBA_exception_free (ev); } |