[BUG] Crash on OSX when external window is used

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 183
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine

[BUG] Crash on OSX when external window is used

Post by Eugene » Tue Oct 23, 2012 2:12 pm

This crash was introduced by this commit:

Code: Select all

Changeset:3705 (5bcdaa1cf833) [OS X] Attempt #2 at fixing the garbage frame.
Branch: v1-8 
User:David Rogers <masterfalcon@ogre3d.org>
Date:2012-08-01 21:20:00 -0500 (2 months)
The reason is that LOC mWindow = [mView window]; stores window pointer without retaining it, and destructor releases it unconditionally.

As I see, mWindow should be not NULL only for owned windows, not for external. Therefore just removing this line should do the right thing. Issue with garbage should not be fixed there as backing store for window could be not yet allocated ( [[mView window] windowNumber] == 0) and attempt to do [mGLContext setView:mView] would cause "invalid drawable" diagnostic in console.
Last edited by Eugene on Thu Nov 01, 2012 10:53 pm, edited 1 time in total.
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: Crash on OSX when external window is used

Post by masterfalcon » Tue Oct 23, 2012 2:31 pm

I assume that you have a fix in mind?
0 x

User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 183
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine

Re: Crash on OSX when external window is used

Post by Eugene » Tue Oct 23, 2012 3:35 pm

masterfalcon wrote:I assume that you have a fix in mind?
Reverting RenderSystems/GL/src/OSX/OgreOSXCocoaWindow.mm to the point before aforementioned changeset solves all issues. On the other hand, backing out ONLY this changeset causes SIGABORT due to the NaNs in viewport calculation code. This issue was introduced by changeset

Code: Select all

Changeset:3815 (8739477ffb96) [OS X] Correctly compute Cocoa window origins and fix repositioning.
Branch: v1-8 
User:David Rogers <masterfalcon@ogre3d.org>
Date:2012-08-27 02:51:14 -0500 (8 weeks)
After rolling back both problematic changesets there are no more crashes.
0 x

User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 183
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine

Re: Crash on OSX when external window is used

Post by Eugene » Tue Oct 23, 2012 3:38 pm

It`s I trying to upgrade Ogre from v1.8 to v1.9 in our application: http://www.belightsoft.com/products/liv ... erview.php

Image
0 x

User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 183
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine

Re: Crash on OSX when external window is used

Post by Eugene » Thu Oct 25, 2012 1:45 pm

It seems that combination OSXCocoaWindow over external view is totally broken, and our program (that uses external views) worked with Ogre v1.8 only because mWindow was NULL.
But this was "fixed" by Changeset:3705 (5bcdaa1cf833) [OS X] Attempt #2 at fixing the garbage frame.

Before with mWindow == NULL delegate registers for notifications from ALL native windows and instantly invokes windowMovedOrResized on our OSXCocoaWindow, but somehow works.
With external mWindow != NULL it is unconditionally released without being retained/created first, that crashes program.

Next issue: mIsExternal is always false - it set to true only in method that is invoked only if mIsExternal is already true.
Next issue: OSXCocoaWindow::windowResized is never invoked, as OSXCocoaWindow is not WindowEventListener nor anybody call it directly. This artifact is from OSXCarbonWindow.
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: Crash on OSX when external window is used

Post by masterfalcon » Thu Oct 25, 2012 3:18 pm

Do you think you'd be able to throw together a small test app for debugging these issues?
0 x

User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 183
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine

Re: Crash on OSX when external window is used

Post by Eugene » Tue Oct 30, 2012 12:02 pm

masterfalcon wrote:Do you think you'd be able to throw together a small test app for debugging these issues?
We need to support HiDPI ("Retina") displays in our application, and Apples API to work with it differentiates between "point" that is a measurement unit for views and windows and "pixel" - rasterizing unit. One "point" maps to one or four "pixels" depending is it normal or retina display. This is very complex task to support in current OSXCocoaWindow implementation as Ogre wants to use pixels but view management is done in points and together with broken external window support it forced us to create separate class similar to the OSXCocoaWindow but intended for external views and supporting Retina rendering.
0 x

Post Reply