From 61bb70de5b746df2e7f274f0b8f6deee3eea3c5f Mon Sep 17 00:00:00 2001 From: "maf@google.com" Date: Thu, 10 Dec 2009 23:29:56 +0000 Subject: Don't screw up the retain count on the original WindowRef referenced by the copy we make of the browser NSWindow. We were accidentally disposing the dummy window in the plugin process that Chrome makes. Review URL: http://codereview.chromium.org/486021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34303 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/plugin/mac/plugin_mac.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'o3d/plugin/mac') diff --git a/o3d/plugin/mac/plugin_mac.mm b/o3d/plugin/mac/plugin_mac.mm index 7b89b32..74354a1 100644 --- a/o3d/plugin/mac/plugin_mac.mm +++ b/o3d/plugin/mac/plugin_mac.mm @@ -114,6 +114,9 @@ bool GetBrowserVersionInfo(int *returned_major, void ReleaseSafariBrowserWindow(void* browserWindow) { NSWindow* cocoaWindow = (NSWindow*) browserWindow; + // Retain the WindowRef so it doesn't go away when we release the + // NSWindow copy we made. + CFRetain([cocoaWindow windowRef]); [cocoaWindow release]; } @@ -124,6 +127,9 @@ void* SafariBrowserWindowForWindowRef(WindowRef theWindow) { if (strcmp(object_getClassName(cocoaWindow), "BrowserWindow") == 0) { return cocoaWindow; } else { + // Retain the WindowRef so it doesn't go away when we release the + // NSWindow copy we made. + CFRetain(theWindow); [cocoaWindow release]; } } @@ -150,6 +156,11 @@ void* SelectedTabForSafariBrowserWindow(void* browserWindow) { // ie DetectTabHiding is now returning false, it restores the surface to the // previous state. void ManageSafariTabSwitching(PluginObject* obj) { + // This is only needed when we are using an AGL context and need to hide + // and show it. + if (!obj->mac_agl_context_) + return; + if (obj->DetectTabHiding()) { if (!obj->mac_surface_hidden_) { obj->mac_surface_hidden_ = true; -- cgit v1.1