Don't crash when resizing non-shaped windows
authorSam Lantinga <slouken@libsdl.org>
Fri, 31 Dec 2010 08:50:06 -0800
changeset 4937 24d44c7c4c63
parent 4936 e99358ca7a8d
child 4938 2af0032520d8
Don't crash when resizing non-shaped windows
src/video/cocoa/SDL_cocoawindow.m
src/video/x11/SDL_x11window.c
--- 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);
 }