[nautilus/gnome-3-10] file-operations: Don't crash after failed inhibit



commit 8bcb7ace01628cf8094ba54d37a67a8d6d7ef621
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Sun Sep 29 08:10:07 2013 +0200

    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

 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 b59ac53..4fa2c1f 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) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]