diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-09-29 08:10:07 +0200 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-11-03 08:10:04 +0200 |
commit | 8bcb7ace01628cf8094ba54d37a67a8d6d7ef621 (patch) | |
tree | 159f8f40eccfe7472253d19fdb9d23dd19c2f240 | |
parent | 7d642d59d502289df4c967780d11596bcb409a18 (diff) | |
download | nautilus-8bcb7ace01628cf8094ba54d37a67a8d6d7ef621.tar.gz |
file-operations: Don't crash after failed inhibit
If gtk_application_inhibit fails, it returns a 0 cookie. When this
invalid value is passed to gtk_application_uninhibit, Nautilus crashes
if glib or gtk is compiled with minimal debug checks.
So, only call gtk_application_uninhibit if a non-zero cookie is
returned. Also, use the correct type for inhibit_cookie (guint).
https://bugzilla.gnome.org/show_bug.cgi?id=709015
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index b59ac53f0..4fa2c1f9c 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -73,7 +73,7 @@ typedef struct { GTimer *time; GtkWindow *parent_window; int screen_num; - int inhibit_cookie; + guint inhibit_cookie; NautilusProgressInfo *progress; GCancellable *cancellable; GHashTable *skip_files; @@ -932,7 +932,7 @@ init_common (gsize job_size, common->progress = nautilus_progress_info_new (); common->cancellable = nautilus_progress_info_get_cancellable (common->progress); common->time = g_timer_new (); - common->inhibit_cookie = -1; + common->inhibit_cookie = 0; common->screen_num = 0; if (parent_window) { screen = gtk_widget_get_screen (GTK_WIDGET (parent_window)); @@ -947,12 +947,12 @@ finalize_common (CommonJob *common) { nautilus_progress_info_finish (common->progress); - if (common->inhibit_cookie != -1) { + if (common->inhibit_cookie != 0) { gtk_application_uninhibit (GTK_APPLICATION (g_application_get_default ()), common->inhibit_cookie); } - common->inhibit_cookie = -1; + common->inhibit_cookie = 0; g_timer_destroy (common->time); if (common->parent_window) { |