Updating branch refs/heads/master
         to 6ffa409bd42a1424d22c34f382b1fc01ae115754 (commit)
       from 70cad8e90010b9b5e5482530de91a3566a69b62c (commit)

commit 6ffa409bd42a1424d22c34f382b1fc01ae115754
Author: Lionel Le Folgoc <[email protected]>
Date:   Thu Mar 29 19:12:10 2012 +0300

    Prevent multiple instances of xfdesktop from running. (Bug 8488)
    
    At the beginning of main(), xfdesktop calls xfdesktop_check_is_running()
    to check that the XFDESKTOP_SELECTION_%d atom isn't set already, in an
    attempt to detect that another instance is already running. But this atom
    is set a lot of code/time later, in 
src/xfce-desktop.c:screen_set_selection().
    
    This means that under some conditions (slow computer, messed up saved 
session
    file), several xfdesktop process can run in parallel, as they manage to pass
    the check because the first process hasn't reached the set_selection code 
already.
    
    Signed-off-by: Eric Koegel <[email protected]>

 src/xfce-desktop.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index bbe0144..13b7c3d 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -528,6 +528,13 @@ screen_set_selection(XfceDesktop *desktop)
     selection_atom = XInternAtom(GDK_DISPLAY(), selection_name, False);
     manager_atom = XInternAtom(GDK_DISPLAY(), "MANAGER", False);
 
+    /* the previous check in src/main.c occurs too early, so workaround by
+     * adding this one. */
+   if(XGetSelectionOwner(GDK_DISPLAY(), selection_atom) != None) {
+       g_warning("%s: already running, quitting.", PACKAGE);
+       exit(0);
+   }
+
     XSelectInput(GDK_DISPLAY(), xwin, PropertyChangeMask | ButtonPressMask);
     XSetSelectionOwner(GDK_DISPLAY(), selection_atom, xwin, GDK_CURRENT_TIME);
 
_______________________________________________
Xfce4-commits mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to