From d06876f45ab479dd8c2defb52299222b57f81ec4 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 13 Dec 2012 14:25:15 +0000 Subject: [PATCH] Bugfix, IRC report (Error in 2.65 release too) Mac OS X: on closing Blender, it 'flashed', which appeared to be a white window opening and closing quickly. Caused by code trying to send focus to another opened window, and accidentally focusing the closed one - causing it to reopen. --- intern/ghost/intern/GHOST_WindowCocoa.mm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 2c833fcaf9d..e044967fdef 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -622,14 +622,19 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa() // back to YES right before closing [m_window setReleasedWhenClosed:YES]; [m_window close]; - m_window = nil; } - //Check for other blender opened windows and make the frontmost key + // Check for other blender opened windows and make the frontmost key + // Note: for some reason the closed window is still in the list NSArray *windowsList = [NSApp orderedWindows]; - if ([windowsList count]) { - [[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil]; + for (int a = 0; a < [windowsList count]; a++) { + if (m_window != (CocoaWindow *)[windowsList objectAtIndex:a]) { + [[windowsList objectAtIndex:a] makeKeyAndOrderFront:nil]; + break; + } } + m_window = nil; + [pool drain]; }