summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2013-09-29 08:10:07 +0200
committerRoss Lagerwall <rosslagerwall@gmail.com>2013-11-03 08:06:26 +0200
commitfb2eaaaa5c9b1472b77c83ae203aecb8e095b096 (patch)
treec8417bd6bdc3352f6c881196a644cd72f4931e71
parenta6bad8e51e4c6672b7653450230b12bda18805e6 (diff)
downloadnautilus-fb2eaaaa5c9b1472b77c83ae203aecb8e095b096.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.c8
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) {