- Don't crash when closing spatial window very quickly after opening it

(gnome bug 552859)
This commit is contained in:
Ray Strode 2009-01-07 20:45:30 +00:00
parent 0632f6a573
commit 29fb407f2f
3 changed files with 170 additions and 110 deletions

View File

@ -107,94 +107,10 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
if (pixmap) { if (pixmap) {
============================================================
Compress multiple background change requests into 1
We may end up in a situation where we need to deal
with a few different things trying to change the
background at the same time in quick succession.
This change avoids duplicated effort by deferring
the work to an idle handler.
diff --git a/eel/eel-background.c b/eel/eel-background.c
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -90,6 +90,7 @@ struct EelBackgroundDetails {
gulong screen_size_handler;
/* Can we use common pixmap for root window and desktop window */
gboolean use_common_pixmap;
+ guint change_idle_id;
};
static void
@@ -701,13 +702,35 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
}
}
-static void
-eel_widget_background_changed (GtkWidget *widget, EelBackground *background)
+static gboolean
+on_background_changed (GtkWidget *widget)
{
+ EelBackground *background;
+
+ background = eel_get_widget_background (widget);
+
+ background->details->change_idle_id = 0;
+
eel_background_unrealize (background);
eel_background_set_up_widget (background, widget);
gtk_widget_queue_draw (widget);
+
+ return FALSE;
+}
+
+static void
+eel_widget_queue_background_change (GtkWidget *widget)
+{
+ EelBackground *background;
+
+ background = eel_get_widget_background (widget);
+
+ if (background->details->change_idle_id > 0) {
+ return;
+ }
+
+ background->details->change_idle_id = g_idle_add ((GSourceFunc) on_background_changed, widget);
}
/* Callback used when the style of a widget changes. We have to regenerate its
@@ -720,7 +743,7 @@ widget_style_set_cb (GtkWidget *widget, GtkStyle *previous_style, gpointer data)
background = EEL_BACKGROUND (data);
- eel_widget_background_changed (widget, background);
+ eel_widget_queue_background_change (widget);
}
static void
@@ -844,8 +867,8 @@ eel_get_widget_background (GtkWidget *widget)
/* Arrange to get the signal whenever the background changes. */
g_signal_connect_object (background, "appearance_changed",
- G_CALLBACK (eel_widget_background_changed), widget, G_CONNECT_SWAPPED);
- eel_widget_background_changed (widget, background);
+ G_CALLBACK (eel_widget_queue_background_change), widget, G_CONNECT_SWAPPED);
+ eel_widget_queue_background_change (widget);
g_signal_connect_object (widget, "style_set",
G_CALLBACK (widget_style_set_cb),
============================================================ ============================================================
Store widget in background details Store widget in background details
It will get used in various places, so keeping It will get used in various places, so keeping
it around simplifies things. Note, backgrounds
are already tied to the lifetime of their widgets
by a g_object_set_data_full call, so we don't need
to worry about nullifying the assignment later,
or taking a reference.
diff --git a/eel/eel-background.c b/eel/eel-background.c diff --git a/eel/eel-background.c b/eel/eel-background.c
--- a/eel/eel-background.c --- a/eel/eel-background.c
@ -207,15 +123,122 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
/* Realized data: */ /* Realized data: */
gboolean background_changes_with_size; gboolean background_changes_with_size;
@@ -864,6 +865,7 @@ eel_get_widget_background (GtkWidget *widget) @@ -806,6 +807,12 @@ eel_background_is_desktop (EelBackground *background)
return background->details->is_desktop;
}
+static void
+on_widget_destroyed (GtkWidget *widget, EelBackground *background)
+{
+ background->details->widget = NULL;
+}
+
/* Gets the background attached to a widget.
If the widget doesn't already have a EelBackground object,
@@ -841,6 +848,8 @@ eel_get_widget_background (GtkWidget *widget)
gtk_object_sink (GTK_OBJECT (background)); gtk_object_sink (GTK_OBJECT (background));
g_object_set_data_full (G_OBJECT (widget), "eel_background", g_object_set_data_full (G_OBJECT (widget), "eel_background",
background, g_object_unref); background, g_object_unref);
+ background->details->widget = widget; + background->details->widget = widget;
+ g_signal_connect_object (widget, "destroy", G_CALLBACK (on_widget_destroyed), background, 0);
/* Arrange to get the signal whenever the background changes. */ /* Arrange to get the signal whenever the background changes. */
g_signal_connect_object (background, "appearance_changed", g_signal_connect_object (background, "appearance_changed",
============================================================
Compress multiple background change requests into 1
We may end up in a situation where we need to deal
with a few different things trying to change the
background at the same time in quick succession.
This change avoids duplicated effort by deferring
the work to an idle handler.
diff --git a/eel/eel-background.c b/eel/eel-background.c
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -91,6 +90,7 @@ struct EelBackgroundDetails {
gulong screen_size_handler;
/* Can we use common pixmap for root window and desktop window */
gboolean use_common_pixmap;
+ guint change_idle_id;
};
static void
@@ -702,13 +702,35 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
}
}
-static void
-eel_widget_background_changed (GtkWidget *widget, EelBackground *background)
+static gboolean
+on_background_changed (EelBackground *background)
{
+ if (background->details->change_idle_id == 0) {
+ return FALSE;
+ }
+
+ background->details->change_idle_id = 0;
+
eel_background_unrealize (background);
- eel_background_set_up_widget (background, widget);
+ eel_background_set_up_widget (background, background->details->widget);
+
+ gtk_widget_queue_draw (background->details->widget);
- gtk_widget_queue_draw (widget);
+ return FALSE;
+}
+
+static void
+eel_widget_queue_background_change (GtkWidget *widget)
+{
+ EelBackground *background;
+
+ background = eel_get_widget_background (widget);
+
+ if (background->details->change_idle_id > 0) {
+ return;
+ }
+
+ background->details->change_idle_id = g_idle_add ((GSourceFunc) on_background_changed, background);
}
/* Callback used when the style of a widget changes. We have to regenerate its
@@ -721,7 +743,7 @@ widget_style_set_cb (GtkWidget *widget, GtkStyle *previous_style, gpointer data)
background = EEL_BACKGROUND (data);
- eel_widget_background_changed (widget, background);
+ eel_widget_queue_background_change (widget);
}
static void
@@ -810,6 +832,11 @@ eel_background_is_desktop (EelBackground *background)
static void
on_widget_destroyed (GtkWidget *widget, EelBackground *background)
{
+ if (background->details->change_idle_id != 0) {
+ g_source_remove (background->details->change_idle_id);
+ background->details->change_idle_id = 0;
+ }
+
background->details->widget = NULL;
}
@@ -853,8 +880,8 @@ eel_get_widget_background (GtkWidget *widget)
/* Arrange to get the signal whenever the background changes. */
g_signal_connect_object (background, "appearance_changed",
- G_CALLBACK (eel_widget_background_changed), widget, G_CONNECT_SWAPPED);
- eel_widget_background_changed (widget, background);
+ G_CALLBACK (eel_widget_queue_background_change), widget, G_CONNECT_SWAPPED);
+ eel_widget_queue_background_change (widget);
g_signal_connect_object (widget, "style_set",
G_CALLBACK (widget_style_set_cb),
============================================================ ============================================================
Add the crossfade transition Add the crossfade transition
@ -223,7 +246,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
diff --git a/eel/eel-background.c b/eel/eel-background.c diff --git a/eel/eel-background.c b/eel/eel-background.c
--- a/eel/eel-background.c --- a/eel/eel-background.c
+++ b/eel/eel-background.c +++ b/eel/eel-background.c
@@ -54,6 +54,9 @@ static GdkPixmap *eel_background_get_pixmap_and_color (EelBackground *backg @@ -53,6 +53,9 @@ static GdkPixmap *eel_background_get_pixmap_and_color (EelBackground *backg
gboolean *changes_with_size); gboolean *changes_with_size);
static void set_image_properties (EelBackground *background); static void set_image_properties (EelBackground *background);
@ -233,7 +256,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
EEL_CLASS_BOILERPLATE (EelBackground, eel_background, GTK_TYPE_OBJECT) EEL_CLASS_BOILERPLATE (EelBackground, eel_background, GTK_TYPE_OBJECT)
enum { enum {
@@ -79,6 +82,7 @@ struct EelBackgroundDetails { @@ -78,6 +81,7 @@ struct EelBackgroundDetails {
/* Realized data: */ /* Realized data: */
gboolean background_changes_with_size; gboolean background_changes_with_size;
GdkPixmap *background_pixmap; GdkPixmap *background_pixmap;
@ -241,7 +264,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
int background_entire_width; int background_entire_width;
int background_entire_height; int background_entire_height;
GdkColor default_color; GdkColor default_color;
@@ -140,6 +144,7 @@ eel_background_class_init (gpointer klass) @@ -139,6 +143,7 @@ eel_background_class_init (gpointer klass)
static void static void
on_bg_changed (GnomeBG *bg, EelBackground *background) on_bg_changed (GnomeBG *bg, EelBackground *background)
{ {
@ -249,7 +272,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
g_signal_emit (G_OBJECT (background), g_signal_emit (G_OBJECT (background),
signals[APPEARANCE_CHANGED], 0); signals[APPEARANCE_CHANGED], 0);
} }
@@ -147,6 +152,7 @@ on_bg_changed (GnomeBG *bg, EelBackground *background) @@ -146,6 +151,7 @@ on_bg_changed (GnomeBG *bg, EelBackground *background)
static void static void
on_bg_transitioned (GnomeBG *bg, EelBackground *background) on_bg_transitioned (GnomeBG *bg, EelBackground *background)
{ {
@ -257,7 +280,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
g_signal_emit (G_OBJECT (background), g_signal_emit (G_OBJECT (background),
signals[APPEARANCE_CHANGED], 0); signals[APPEARANCE_CHANGED], 0);
} }
@@ -186,6 +192,15 @@ eel_background_remove_current_image (EelBackground *background) @@ -185,6 +191,15 @@ eel_background_remove_current_image (EelBackground *background)
} }
static void static void
@ -273,7 +296,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
eel_background_finalize (GObject *object) eel_background_finalize (GObject *object)
{ {
EelBackground *background; EelBackground *background;
@@ -200,6 +215,8 @@ eel_background_finalize (GObject *object) @@ -199,6 +214,8 @@ eel_background_finalize (GObject *object)
background->details->background_pixmap = NULL; background->details->background_pixmap = NULL;
} }
@ -282,7 +305,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
g_free (background->details); g_free (background->details);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
@@ -649,6 +666,33 @@ set_root_pixmap (EelBackground *background, @@ -648,6 +665,33 @@ set_root_pixmap (EelBackground *background,
g_object_unref (root_pixmap); g_object_unref (root_pixmap);
} }
@ -316,7 +339,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
static void static void
eel_background_set_up_widget (EelBackground *background, GtkWidget *widget) eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
{ {
@@ -661,6 +705,7 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget) @@ -660,6 +704,7 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
GdkWindow *window; GdkWindow *window;
gboolean changes_with_size; gboolean changes_with_size;
@ -324,7 +347,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
if (!GTK_WIDGET_REALIZED (widget)) { if (!GTK_WIDGET_REALIZED (widget)) {
return; return;
@@ -683,18 +728,25 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget) @@ -682,18 +727,25 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
window = widget->window; window = widget->window;
} }
@ -352,16 +375,7 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
set_root_pixmap (background, window); set_root_pixmap (background, window);
} }
@@ -707,7 +759,7 @@ static gboolean @@ -720,6 +772,36 @@ on_background_changed (EelBackground *background)
on_background_changed (GtkWidget *widget)
{
EelBackground *background;
-
+
background = eel_get_widget_background (widget);
background->details->change_idle_id = 0;
@@ -721,10 +773,40 @@ on_background_changed (GtkWidget *widget)
} }
static void static void
@ -398,8 +412,3 @@ diff --git a/eel/eel-background.c b/eel/eel-background.c
eel_widget_queue_background_change (GtkWidget *widget) eel_widget_queue_background_change (GtkWidget *widget)
{ {
EelBackground *background; EelBackground *background;
-
+
background = eel_get_widget_background (widget);
if (background->details->change_idle_id > 0) {

View File

@ -0,0 +1,45 @@
diff -up nautilus-2.25.2/src/nautilus-window-slot.c.fix-crasher nautilus-2.25.2/src/nautilus-window-slot.c
--- nautilus-2.25.2/src/nautilus-window-slot.c.fix-crasher 2009-01-07 14:19:02.542397115 -0500
+++ nautilus-2.25.2/src/nautilus-window-slot.c 2009-01-07 14:15:25.815412326 -0500
@@ -570,6 +570,20 @@ nautilus_window_slot_dispose (GObject *o
slot = NAUTILUS_WINDOW_SLOT (object);
+ if (slot->content_view) {
+ widget = nautilus_view_get_widget (slot->content_view);
+ gtk_widget_destroy (widget);
+ g_object_unref (slot->content_view);
+ slot->content_view = NULL;
+ }
+
+ if (slot->new_content_view) {
+ widget = nautilus_view_get_widget (slot->new_content_view);
+ gtk_widget_destroy (widget);
+ g_object_unref (slot->new_content_view);
+ slot->new_content_view = NULL;
+ }
+
nautilus_window_slot_set_viewed_file (slot, NULL);
/* TODO? why do we unref here? the file is NULL.
* It was already here before the slot move, though */
@@ -598,20 +612,6 @@ nautilus_window_slot_dispose (GObject *o
slot->find_mount_cancellable = NULL;
}
- if (slot->content_view) {
- widget = nautilus_view_get_widget (slot->content_view);
- gtk_widget_destroy (widget);
- g_object_unref (slot->content_view);
- slot->content_view = NULL;
- }
-
- if (slot->new_content_view) {
- widget = nautilus_view_get_widget (slot->new_content_view);
- gtk_widget_destroy (widget);
- g_object_unref (slot->new_content_view);
- slot->new_content_view = NULL;
- }
-
slot->window = NULL;
g_free (slot->title);

View File

@ -16,7 +16,7 @@
Name: nautilus Name: nautilus
Summary: File manager for GNOME Summary: File manager for GNOME
Version: 2.25.2 Version: 2.25.2
Release: 5%{?dist} Release: 6%{?dist}
License: GPLv2+ License: GPLv2+
Group: User Interface/Desktops Group: User Interface/Desktops
Source: http://download.gnome.org/sources/%{name}/2.25/%{name}-%{version}.tar.bz2 Source: http://download.gnome.org/sources/%{name}/2.25/%{name}-%{version}.tar.bz2
@ -91,6 +91,7 @@ Patch17: nautilus-filetype-symlink-fix.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=552859 # http://bugzilla.gnome.org/show_bug.cgi?id=552859
Patch18: eel-2.24.0-fade.patch Patch18: eel-2.24.0-fade.patch
Patch19: nautilus-2.25.2-fix-crasher.patch
%description %description
@ -132,6 +133,7 @@ for developing nautilus extensions.
%patch15 -p1 -b .xds %patch15 -p1 -b .xds
%patch17 -p0 -b .symlink %patch17 -p0 -b .symlink
%patch18 -p1 -b .fade %patch18 -p1 -b .fade
%patch19 -p1 -b .fix-crasher
%build %build
@ -263,6 +265,10 @@ fi
%changelog %changelog
* Wed Jan 7 2009 Ray Strode <rstrode@redhat.com> - 2.25.2-6
- Don't crash when closing spatial window very quickly after
opening it (gnome bug 552859)
* Thu Dec 18 2008 Matthias Clasen <mclasen@redhat.com> - 2.25.2-5 * Thu Dec 18 2008 Matthias Clasen <mclasen@redhat.com> - 2.25.2-5
- Fix spec - Fix spec