Commit 2bb344d6dc68acd8e9b8687ce2324e89b62e1f91

Sam Lantinga 2013-11-27T10:29:27

Don't crash when no WM is present. CR: Sam Lantinga.

diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java
old mode 100755
new mode 100644
diff --git a/premake/Linux/SDL_config_premake.h b/premake/Linux/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/MinGW/SDL_config_premake.h b/premake/MinGW/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/VisualC/VS2008/SDL_config_premake.h b/premake/VisualC/VS2008/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/VisualC/VS2010/SDL_config_premake.h b/premake/VisualC/VS2010/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/VisualC/VS2012/SDL_config_premake.h b/premake/VisualC/VS2012/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/Xcode-iOS/SDL_config_premake.h b/premake/Xcode-iOS/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/Xcode/Xcode3/SDL_config_premake.h b/premake/Xcode/Xcode3/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/Xcode/Xcode4/SDL_config_premake.h b/premake/Xcode/Xcode4/SDL_config_premake.h
old mode 100755
new mode 100644
diff --git a/premake/config/SDL_config_cygwin.template.h b/premake/config/SDL_config_cygwin.template.h
old mode 100755
new mode 100644
diff --git a/premake/config/SDL_config_iphoneos.template.h b/premake/config/SDL_config_iphoneos.template.h
old mode 100755
new mode 100644
diff --git a/premake/config/SDL_config_linux.template.h b/premake/config/SDL_config_linux.template.h
old mode 100755
new mode 100644
diff --git a/premake/config/SDL_config_macosx.template.h b/premake/config/SDL_config_macosx.template.h
old mode 100755
new mode 100644
diff --git a/premake/config/SDL_config_minimal.template.h b/premake/config/SDL_config_minimal.template.h
old mode 100755
new mode 100644
diff --git a/premake/config/SDL_config_windows.template.h b/premake/config/SDL_config_windows.template.h
old mode 100755
new mode 100644
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
old mode 100755
new mode 100644
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
old mode 100755
new mode 100644
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
old mode 100755
new mode 100644
diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h
old mode 100755
new mode 100644
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index c84d4ec..49183e6 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -440,8 +440,8 @@ X11_CheckWindowManager(_THIS)
     Atom _NET_SUPPORTING_WM_CHECK;
     int status, real_format;
     Atom real_type;
-    unsigned long items_read, items_left;
-    unsigned char *propdata;
+    unsigned long items_read = 0, items_left = 0;
+    unsigned char *propdata = NULL;
     Window wm_window = 0;
 #ifdef DEBUG_WINDOW_MANAGER
     char *wm_name;
@@ -453,11 +453,14 @@ X11_CheckWindowManager(_THIS)
 
     _NET_SUPPORTING_WM_CHECK = X11_XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
     status = X11_XGetWindowProperty(display, DefaultRootWindow(display), _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
-    if (status == Success && items_read) {
-        wm_window = ((Window*)propdata)[0];
-    }
-    if (propdata) {
-        X11_XFree(propdata);
+    if (status == Success) {
+        if (items_read) {
+            wm_window = ((Window*)propdata)[0];
+        }
+        if (propdata) {
+            X11_XFree(propdata);
+            propdata = NULL;
+        }
     }
 
     if (wm_window) {
@@ -465,8 +468,9 @@ X11_CheckWindowManager(_THIS)
         if (status != Success || !items_read || wm_window != ((Window*)propdata)[0]) {
             wm_window = None;
         }
-        if (propdata) {
+        if (status == Success && propdata) {
             X11_XFree(propdata);
+            propdata = NULL;
         }
     }
 
diff --git a/visualtest/config.h b/visualtest/config.h
old mode 100755
new mode 100644
diff --git a/visualtest/docs/html/bc_s.png b/visualtest/docs/html/bc_s.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/bc_s.png and b/visualtest/docs/html/bc_s.png differ
diff --git a/visualtest/docs/html/bdwn.png b/visualtest/docs/html/bdwn.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/bdwn.png and b/visualtest/docs/html/bdwn.png differ
diff --git a/visualtest/docs/html/closed.png b/visualtest/docs/html/closed.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/closed.png and b/visualtest/docs/html/closed.png differ
diff --git a/visualtest/docs/html/doxygen.png b/visualtest/docs/html/doxygen.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/doxygen.png and b/visualtest/docs/html/doxygen.png differ
diff --git a/visualtest/docs/html/ftv2blank.png b/visualtest/docs/html/ftv2blank.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2blank.png and b/visualtest/docs/html/ftv2blank.png differ
diff --git a/visualtest/docs/html/ftv2cl.png b/visualtest/docs/html/ftv2cl.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2cl.png and b/visualtest/docs/html/ftv2cl.png differ
diff --git a/visualtest/docs/html/ftv2doc.png b/visualtest/docs/html/ftv2doc.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2doc.png and b/visualtest/docs/html/ftv2doc.png differ
diff --git a/visualtest/docs/html/ftv2folderclosed.png b/visualtest/docs/html/ftv2folderclosed.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2folderclosed.png and b/visualtest/docs/html/ftv2folderclosed.png differ
diff --git a/visualtest/docs/html/ftv2folderopen.png b/visualtest/docs/html/ftv2folderopen.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2folderopen.png and b/visualtest/docs/html/ftv2folderopen.png differ
diff --git a/visualtest/docs/html/ftv2lastnode.png b/visualtest/docs/html/ftv2lastnode.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2lastnode.png and b/visualtest/docs/html/ftv2lastnode.png differ
diff --git a/visualtest/docs/html/ftv2link.png b/visualtest/docs/html/ftv2link.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2link.png and b/visualtest/docs/html/ftv2link.png differ
diff --git a/visualtest/docs/html/ftv2mlastnode.png b/visualtest/docs/html/ftv2mlastnode.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2mlastnode.png and b/visualtest/docs/html/ftv2mlastnode.png differ
diff --git a/visualtest/docs/html/ftv2mnode.png b/visualtest/docs/html/ftv2mnode.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2mnode.png and b/visualtest/docs/html/ftv2mnode.png differ
diff --git a/visualtest/docs/html/ftv2mo.png b/visualtest/docs/html/ftv2mo.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2mo.png and b/visualtest/docs/html/ftv2mo.png differ
diff --git a/visualtest/docs/html/ftv2node.png b/visualtest/docs/html/ftv2node.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2node.png and b/visualtest/docs/html/ftv2node.png differ
diff --git a/visualtest/docs/html/ftv2ns.png b/visualtest/docs/html/ftv2ns.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2ns.png and b/visualtest/docs/html/ftv2ns.png differ
diff --git a/visualtest/docs/html/ftv2plastnode.png b/visualtest/docs/html/ftv2plastnode.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2plastnode.png and b/visualtest/docs/html/ftv2plastnode.png differ
diff --git a/visualtest/docs/html/ftv2pnode.png b/visualtest/docs/html/ftv2pnode.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2pnode.png and b/visualtest/docs/html/ftv2pnode.png differ
diff --git a/visualtest/docs/html/ftv2splitbar.png b/visualtest/docs/html/ftv2splitbar.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2splitbar.png and b/visualtest/docs/html/ftv2splitbar.png differ
diff --git a/visualtest/docs/html/ftv2vertline.png b/visualtest/docs/html/ftv2vertline.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/ftv2vertline.png and b/visualtest/docs/html/ftv2vertline.png differ
diff --git a/visualtest/docs/html/nav_f.png b/visualtest/docs/html/nav_f.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/nav_f.png and b/visualtest/docs/html/nav_f.png differ
diff --git a/visualtest/docs/html/nav_g.png b/visualtest/docs/html/nav_g.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/nav_g.png and b/visualtest/docs/html/nav_g.png differ
diff --git a/visualtest/docs/html/nav_h.png b/visualtest/docs/html/nav_h.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/nav_h.png and b/visualtest/docs/html/nav_h.png differ
diff --git a/visualtest/docs/html/open.png b/visualtest/docs/html/open.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/open.png and b/visualtest/docs/html/open.png differ
diff --git a/visualtest/docs/html/search/close.png b/visualtest/docs/html/search/close.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/search/close.png and b/visualtest/docs/html/search/close.png differ
diff --git a/visualtest/docs/html/search/mag_sel.png b/visualtest/docs/html/search/mag_sel.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/search/mag_sel.png and b/visualtest/docs/html/search/mag_sel.png differ
diff --git a/visualtest/docs/html/search/search_l.png b/visualtest/docs/html/search/search_l.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/search/search_l.png and b/visualtest/docs/html/search/search_l.png differ
diff --git a/visualtest/docs/html/search/search_m.png b/visualtest/docs/html/search/search_m.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/search/search_m.png and b/visualtest/docs/html/search/search_m.png differ
diff --git a/visualtest/docs/html/search/search_r.png b/visualtest/docs/html/search/search_r.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/search/search_r.png and b/visualtest/docs/html/search/search_r.png differ
diff --git a/visualtest/docs/html/sync_off.png b/visualtest/docs/html/sync_off.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/sync_off.png and b/visualtest/docs/html/sync_off.png differ
diff --git a/visualtest/docs/html/sync_on.png b/visualtest/docs/html/sync_on.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/sync_on.png and b/visualtest/docs/html/sync_on.png differ
diff --git a/visualtest/docs/html/tab_a.png b/visualtest/docs/html/tab_a.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/tab_a.png and b/visualtest/docs/html/tab_a.png differ
diff --git a/visualtest/docs/html/tab_b.png b/visualtest/docs/html/tab_b.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/tab_b.png and b/visualtest/docs/html/tab_b.png differ
diff --git a/visualtest/docs/html/tab_h.png b/visualtest/docs/html/tab_h.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/tab_h.png and b/visualtest/docs/html/tab_h.png differ
diff --git a/visualtest/docs/html/tab_s.png b/visualtest/docs/html/tab_s.png
old mode 100755
new mode 100644
Binary files a/visualtest/docs/html/tab_s.png and b/visualtest/docs/html/tab_s.png differ
diff --git a/visualtest/include/SDL_visualtest_action_configparser.h b/visualtest/include/SDL_visualtest_action_configparser.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_exhaustive_variator.h b/visualtest/include/SDL_visualtest_exhaustive_variator.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_harness_argparser.h b/visualtest/include/SDL_visualtest_harness_argparser.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_mischelper.h b/visualtest/include/SDL_visualtest_mischelper.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_parsehelper.h b/visualtest/include/SDL_visualtest_parsehelper.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_process.h b/visualtest/include/SDL_visualtest_process.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_random_variator.h b/visualtest/include/SDL_visualtest_random_variator.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_rwhelper.h b/visualtest/include/SDL_visualtest_rwhelper.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_screenshot.h b/visualtest/include/SDL_visualtest_screenshot.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_sut_configparser.h b/visualtest/include/SDL_visualtest_sut_configparser.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_variator_common.h b/visualtest/include/SDL_visualtest_variator_common.h
old mode 100755
new mode 100644
diff --git a/visualtest/include/SDL_visualtest_variators.h b/visualtest/include/SDL_visualtest_variators.h
old mode 100755
new mode 100644
diff --git a/visualtest/src/action_configparser.c b/visualtest/src/action_configparser.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/harness_argparser.c b/visualtest/src/harness_argparser.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/linux/linux_process.c b/visualtest/src/linux/linux_process.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/mischelper.c b/visualtest/src/mischelper.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/parsehelper.c b/visualtest/src/parsehelper.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/rwhelper.c b/visualtest/src/rwhelper.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/screenshot.c b/visualtest/src/screenshot.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/sut_configparser.c b/visualtest/src/sut_configparser.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/testharness.c b/visualtest/src/testharness.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/variator_common.c b/visualtest/src/variator_common.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/variator_exhaustive.c b/visualtest/src/variator_exhaustive.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/variator_random.c b/visualtest/src/variator_random.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/variators.c b/visualtest/src/variators.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/windows/windows_process.c b/visualtest/src/windows/windows_process.c
old mode 100755
new mode 100644
diff --git a/visualtest/src/windows/windows_screenshot.c b/visualtest/src/windows/windows_screenshot.c
old mode 100755
new mode 100644
diff --git a/visualtest/unittest/testquit.c b/visualtest/unittest/testquit.c
old mode 100755
new mode 100644