components/gnome/glib2/patches/11-file-monitor-segfault.patch
changeset 5891 196a7310cc4d
equal deleted inserted replaced
5890:e3686c085735 5891:196a7310cc4d
       
     1 Patch from upstream to fix segfault introduced in 2.46.0 that
       
     2 causes Nautilus to crash on startup in our GNOME 2.30 desktop.
       
     3 
       
     4 From 30359e740953b596d6c3d980dba36dd131681a1f Mon Sep 17 00:00:00 2001
       
     5 From: Allison Ryan Lortie <[email protected]>
       
     6 Date: Mon, 30 Nov 2015 10:13:46 -0500
       
     7 Subject: [PATCH] file monitors: reorder some code to avoid segfault
       
     8 
       
     9 We must initialise '->source' before we use fields inside of it.
       
    10 
       
    11 https://bugzilla.gnome.org/show_bug.cgi?id=758823
       
    12 ---
       
    13  gio/glocalfilemonitor.c | 6 +++---
       
    14  1 file changed, 3 insertions(+), 3 deletions(-)
       
    15 
       
    16 diff --git a/gio/glocalfilemonitor.c b/gio/glocalfilemonitor.c
       
    17 index dbd62ec..49a4dd2 100644
       
    18 --- a/gio/glocalfilemonitor.c
       
    19 +++ b/gio/glocalfilemonitor.c
       
    20 @@ -748,6 +748,9 @@ g_local_file_monitor_start (GLocalFileMonitor *local_monitor,
       
    21  
       
    22    g_assert (!local_monitor->source);
       
    23  
       
    24 +  source = g_file_monitor_source_new (local_monitor, filename, is_directory, flags);
       
    25 +  local_monitor->source = source; /* owns the ref */
       
    26 +
       
    27    if (is_directory && !class->mount_notify && (flags & G_FILE_MONITOR_WATCH_MOUNTS))
       
    28      {
       
    29  #ifdef G_OS_WIN32
       
    30 @@ -771,9 +774,6 @@ g_local_file_monitor_start (GLocalFileMonitor *local_monitor,
       
    31  #endif
       
    32      }
       
    33  
       
    34 -  source = g_file_monitor_source_new (local_monitor, filename, is_directory, flags);
       
    35 -  local_monitor->source = source; /* owns the ref */
       
    36 -
       
    37    G_LOCAL_FILE_MONITOR_GET_CLASS (local_monitor)->start (local_monitor,
       
    38                                                           source->dirname, source->basename, source->filename,
       
    39                                                           source);
       
    40 -- 
       
    41 2.7.4
       
    42