Properly Close browser on OSX [standard rendering]

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Properly Close browser on OSX [standard rendering]

Postby joaoneves » Mon Mar 02, 2020 11:24 am

Hi,

Using standard rendering I want to close the browser but not the hosting window.
I'm calling BrowserHost.CloseBrowser and the CefLifeSpanHandler.DoClose gets called (as expected).
To prevent the hosting window from being closed the DoClose returns true.
On Windows I also explicitly close the browser window through DestroyWindow (inside DoClose) and the auxiliary process goes away.
What about OSX? How do I properly get rid of the browser (auxiliary process remains alive)?
joaoneves
Techie
 
Posts: 14
Joined: Fri Nov 29, 2019 5:45 am

Re: Properly Close browser on OSX [standard rendering]

Postby magreenblatt » Mon Mar 02, 2020 11:33 am

On macOS you need to release the NSView hosting the browser. This is generally done by removing it from the parent NSWindow/NSView and making sure that you’ve kept no references via retain.
magreenblatt
Site Admin
 
Posts: 10652
Joined: Fri May 29, 2009 6:57 pm

Re: Properly Close browser on OSX [standard rendering]

Postby joaoneves » Wed Mar 04, 2020 7:59 am

Thanks. That was it, wasn't properly removing the browser from its parent nsview.
joaoneves
Techie
 
Posts: 14
Joined: Fri Nov 29, 2019 5:45 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 6 guests