Browse Source

Fix segfault when calling XCloseDisplay() with improper Display argument

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/slim/trunk@142 7c53e7cc-98ea-0310-8f1f-a0b24da60408
winkj 16 years ago
parent
commit
f2989b9753
2 changed files with 3 additions and 1 deletions
  1. 1 0
      ChangeLog
  2. 2 1
      app.cpp

+ 1 - 0
ChangeLog

@@ -5,6 +5,7 @@
     * Fixed vt argument detection, thanks to Henrik Brix Andersen
     * Corrected reference to input_color in the default theme
     * Fixed default shell setting
+    * Fix segfault when calling XCloseDisplay(NULL); thanks Uli Schlachter
 
 1.2.6 - 2006.09.15
     * Bug #008167: Update pid when in daemon mode

+ 2 - 1
app.cpp

@@ -135,6 +135,7 @@ App::App(int argc, char** argv){
     ServerPID = -1;
     testing = false;
     mcookie = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+    Dpy = NULL;
 
     // Parse command line
     while((tmp = getopt(argc, argv, "vhp:d?")) != EOF) {
@@ -930,7 +931,7 @@ void App::StopServer() {
 
     // Catch X error
     XSetIOErrorHandler(IgnoreXIO);
-    if(!setjmp(CloseEnv))
+    if(!setjmp(CloseEnv) && Dpy)
         XCloseDisplay(Dpy);
 
     // Send HUP to process group