Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Crash on display configuration change (in NSOpenGLView subclass)



I have an NSOpenGLView subclass, and display configuration changes such as attaching or removing a second display are causing strange crashes. I've followed the information in various technotes, notably I am calling update as follows:

- (void)update
{
  [self lockGLContext];
  [[self openGLContext] update];
  [self unlockGLContext];
}

- (void) lockGLContext
{
CGLContextObj cglCtx = (CGLContextObj) [[self openGLContext] CGLContextObj];
CGLLockContext(cglCtx);
}


- (void) unlockGLContext
{
CGLContextObj cglCtx = (CGLContextObj) [[self openGLContext] CGLContextObj];
CGLUnlockContext(cglCtx);
}


This is necessary because (and I suspect this may be relevant to the crash) all my OpenGL drawing is done from a dedicated thread, separate from the main thread.

The actual crash occurs some time after update has completed; the nature of the crash invariably suggests memory corruption deep inside the application or libraries.

So, is there anything intrinsically wrong with the above code, or something else I might be doing wrong in this scenario?

Thanks,
James
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.