Fix crash on Windows when clicking anywhere in a window. Cursor grabbing code was...
authorJoshua Leung <aligorith@gmail.com>
Wed, 18 Nov 2009 21:01:04 +0000 (21:01 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 18 Nov 2009 21:01:04 +0000 (21:01 +0000)
source/blender/windowmanager/intern/wm_cursors.c

index 9a8c3db0987c987b8a23ab63c1a7099bf055b1ea..6145871f9d40b4183cb7e10631b6968f61f02e28 100644 (file)
@@ -173,16 +173,22 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
        if(hide)                mode = GHOST_kGrabHide;
        else if(wrap)   mode = GHOST_kGrabWrap;
 
-       if ((G.f & G_DEBUG) == 0)
-               if(win && (GHOST_GetTabletData(win->ghostwin)->Active == GHOST_kTabletModeNone))
-                       GHOST_SetCursorGrab(win->ghostwin, mode, bounds);
+       if ((G.f & G_DEBUG) == 0) {
+               if (win && win->ghostwin) {
+                       const GHOST_TabletData *tabletdata= GHOST_GetTabletData(win->ghostwin);
+                       
+                       if ((tabletdata) && (tabletdata->Active == GHOST_kTabletModeNone))
+                               GHOST_SetCursorGrab(win->ghostwin, mode, bounds);
+               }
+       }
 }
 
 void WM_cursor_ungrab(wmWindow *win)
 {
-       if ((G.f & G_DEBUG) == 0)
+       if ((G.f & G_DEBUG) == 0) {
                if(win && win->ghostwin)
                        GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL);
+       }
 }
 
 /* afer this you can call restore too */