Nautilus hard code freeze break request: memory leak in slot handling
- From: Christian Neumair <cneumair gnome org>
- To: Release Team <release-team gnome org>
- Subject: Nautilus hard code freeze break request: memory leak in slot handling
- Date: Sun, 21 Sep 2008 11:47:12 +0200
I've introduced a memory leak with the view slot code, that Matthias
Clasen just found:
http://bugzilla.gnome.org/show_bug.cgi?id=553081
The attached patch
* removes nautilus_window_manage_views_destroy(), because the preceeding
calls in nautilus_window_destroy() to NautilusWindow's real_close_slot
-> nautilus_window_manage_views_close_slot() already do the very same
calls.
* fixes a leak because the active slot list now is updated in the
internal nautilus_window_close_slot() call, rather than the external
proxy nautilus_slot_close(). This required slight changes to
nautilus_window_slot_close().
OK to commit?
--
Christian Neumair <cneumair gnome org>
Index: src/nautilus-window-manage-views.c
===================================================================
--- src/nautilus-window-manage-views.c (Revision 14632)
+++ src/nautilus-window-manage-views.c (Arbeitskopie)
@@ -2019,28 +2019,6 @@ nautilus_window_slot_set_content_view (N
}
void
-nautilus_window_manage_views_destroy (NautilusWindow *window)
-{
- NautilusWindowSlot *slot;
- GList *l;
-
- /* Disconnect view signals here so they don't trigger when
- * views are destroyed.
- */
-
- for (l = window->details->slots; l != NULL; l = l->next) {
- slot = l->data;
-
- if (slot->content_view != NULL) {
- nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
- }
- if (slot->new_content_view != NULL) {
- nautilus_window_slot_disconnect_content_view (slot, slot->new_content_view);
- }
- }
-}
-
-void
nautilus_window_manage_views_close_slot (NautilusWindow *window,
NautilusWindowSlot *slot)
{
Index: src/nautilus-window-manage-views.h
===================================================================
--- src/nautilus-window-manage-views.h (Revision 14632)
+++ src/nautilus-window-manage-views.h (Arbeitskopie)
@@ -30,7 +30,6 @@
#include "nautilus-window.h"
#include "nautilus-navigation-window.h"
-void nautilus_window_manage_views_destroy (NautilusWindow *window);
void nautilus_window_manage_views_close_slot (NautilusWindow *window,
NautilusWindowSlot *slot);
Index: src/nautilus-window.c
===================================================================
--- src/nautilus-window.c (Revision 14632)
+++ src/nautilus-window.c (Arbeitskopie)
@@ -609,8 +609,6 @@ nautilus_window_destroy (GtkObject *obje
}
g_list_free (slots);
- nautilus_window_manage_views_destroy (window);
-
GTK_OBJECT_CLASS (nautilus_window_parent_class)->destroy (object);
}
@@ -737,6 +735,8 @@ nautilus_window_close_slot (NautilusWind
close_slot, (window, slot));
window->details->slots = g_list_remove (window->details->slots, slot);
+ window->details->active_slots = g_list_remove (window->details->active_slots, slot);
+
}
void
@@ -791,16 +791,6 @@ nautilus_window_set_active_slot (Nautilu
}
static inline NautilusWindowSlot *
-get_last_active_slot (NautilusWindow *window)
-{
- if (window->details->active_slots != NULL) {
- return NAUTILUS_WINDOW_SLOT (window->details->active_slots->data);
- }
-
- return NULL;
-}
-
-static inline NautilusWindowSlot *
get_first_inactive_slot (NautilusWindow *window)
{
GList *l;
@@ -824,10 +814,15 @@ nautilus_window_slot_close (NautilusWind
window = slot->window;
if (window != NULL) {
- window->details->active_slots = g_list_remove (window->details->active_slots, slot);
-
if (window->details->active_slot == slot) {
- next_slot = get_last_active_slot (window);
+ g_assert (window->details->active_slots != NULL);
+ g_assert (window->details->active_slots->data == slot);
+
+ next_slot = NULL;
+ if (window->details->active_slots->next != NULL) {
+ next_slot = NAUTILUS_WINDOW_SLOT (window->details->active_slots->next->data);
+ }
+
if (next_slot == NULL) {
next_slot = get_first_inactive_slot (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]