[gnome-session] [capplet] Fix crash when the user file becomes identical to system one



commit 377b5885d0cfb5920e72f8e7d88aed62c995c54b
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Jun 23 17:53:56 2009 +0200

    [capplet] Fix crash when the user file becomes identical to system one
    
    When we edit an autostart desktop file and it becomes identical to the
    system one, we simply remove the user desktop file. This case was not
    correctly handled and triggered an assertion.

 capplet/gsp-app-manager.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/capplet/gsp-app-manager.c b/capplet/gsp-app-manager.c
index 201da48..9ced072 100644
--- a/capplet/gsp-app-manager.c
+++ b/capplet/gsp-app-manager.c
@@ -280,6 +280,15 @@ _gsp_app_manager_handle_delete (GspAppManager *manager,
                 return;
         }
 
+        if (index < position) {
+                /* it got deleted, but in a position earlier than the current
+                 * one. This happens when the user file was changed and became
+                 * identical to the system file; in this case, the user file is
+                 * simply removed. */
+                 g_assert (index == 0);
+                 return;
+        }
+
         if (position == index &&
             (system_position == index || system_position == G_MAXUINT)) {
                 /* the file used by the user was deleted, and there's no other



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