From 8ac0359852f1eb8597bfc847c5a4891d61adae20 Mon Sep 17 00:00:00 2001 From: Damien Plisson Date: Tue, 16 Mar 2010 20:42:12 +0000 Subject: [PATCH] Fix [#21634] GHOST_WindowCocoa: activeWindow null pointer check --- intern/ghost/intern/GHOST_SystemCocoa.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index bcbc59a34a9..20d5cc7165a 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -774,15 +774,17 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow( GHOST_TSuccess GHOST_SystemCocoa::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual) { GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow(); - *window = currentWindow; + if(!currentWindow) return GHOST_kFailure; + return currentWindow->setState(GHOST_kWindowStateFullScreen); } GHOST_TSuccess GHOST_SystemCocoa::endFullScreen(void) { GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow(); + if(!currentWindow) return GHOST_kFailure; return currentWindow->setState(GHOST_kWindowStateNormal); } @@ -809,6 +811,8 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 { float xf=(float)x, yf=(float)y; GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow(); + if (!window) return GHOST_kFailure; + NSScreen *windowScreen = window->getScreen(); NSRect screenRect = [windowScreen frame];