Jari Rahkonen wrote:
> It seems like the bug is triggered as long as I can write to the file.
> Everything's fine if I don't have those permissions (e.g. if I set the
> file permissions to something like -r--r--r-- or the file is owned and
> only writable by root). That way the widgets in the Launcher tab are
> insensitive but then the dialog doesn't close unexpectedly.

Seems to be a race condition between g_file_set_content() and inotify.
Please try the attached patch.

> - Jari

Benedikt
Index: plugins/thunar-apr/thunar-apr-desktop-page.c
===================================================================
--- plugins/thunar-apr/thunar-apr-desktop-page.c	(revision 21419)
+++ plugins/thunar-apr/thunar-apr-desktop-page.c	(working copy)
@@ -496,9 +496,7 @@
   gchar     *data;
   gchar     *uri;
   gsize      data_length;
-#if !GLIB_CHECK_VERSION(2,8,0)
   FILE      *fp;
-#endif
 
   /* verify that we still have a valid file */
   if (THUNAR_APR_ABSTRACT_PAGE (desktop_page)->file == NULL)
@@ -527,20 +525,17 @@
       if (G_LIKELY (data != NULL))
         {
           /* try to save the key file content to disk */
-#if GLIB_CHECK_VERSION(2,8,0)
-          g_file_set_contents (filename, data, data_length, &error);
-#else
           fp = fopen (filename, "w");
           if (G_LIKELY (fp != NULL))
             {
-              fwrite (data, data_length, 1, fp);
+              if (fwrite (data, data_length, 1, fp) != 1)
+                error = g_error_new_literal (G_FILE_ERROR, g_file_error_from_errno (errno), g_strerror (errno));
               fclose (fp);
             }
           else
             {
               error = g_error_new_literal (G_FILE_ERROR, g_file_error_from_errno (errno), g_strerror (errno));
             }
-#endif
 
           /* cleanup */
           g_free (data);
_______________________________________________
Thunar-dev mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/thunar-dev

Reply via email to