changeset 4937:24d44c7c4c63

Don't crash when resizing non-shaped windows
author Sam Lantinga <slouken@libsdl.org>
date Fri, 31 Dec 2010 08:50:06 -0800
parents e99358ca7a8d
children 2af0032520d8
files src/video/cocoa/SDL_cocoawindow.m src/video/x11/SDL_x11window.c
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoawindow.m	Fri Dec 31 08:42:47 2010 -0800
+++ b/src/video/cocoa/SDL_cocoawindow.m	Fri Dec 31 08:50:06 2010 -0800
@@ -117,7 +117,8 @@
     NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
     w = (int)rect.size.width;
     h = (int)rect.size.height;
-    Cocoa_ResizeWindowShape(_data->window);
+    if (SDL_IsShapedWindow(_data->window))
+        Cocoa_ResizeWindowShape(_data->window);
     SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
 }
 
--- a/src/video/x11/SDL_x11window.c	Fri Dec 31 08:42:47 2010 -0800
+++ b/src/video/x11/SDL_x11window.c	Fri Dec 31 08:50:06 2010 -0800
@@ -942,7 +942,7 @@
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     Display *display = data->videodata->display;
 
-    if(SDL_IsShapedWindow(window))
+    if (SDL_IsShapedWindow(window))
         X11_ResizeWindowShape(window);
     XResizeWindow(display, data->xwindow, window->w, window->h);
 }