OpenGL/Carbon/Cocoa Memory Management Autorelease issue

Posted by Stephen Furlani on Stack Overflow See other posts from Stack Overflow or by Stephen Furlani
Published on 2010-05-14T14:58:33Z Indexed on 2010/05/14 16:54 UTC
Read the original article Hit count: 382

Filed under:
|
|
|
|

Hoooboy,

I've got another doozy of a memory problem.

I'm creating a Carbon (AGL) Window, in C++ and it's telling me that I'm autorelease-ing it without a pool in place.

uh... what?

I thought Carbon existed outside of the NSAutoreleasePool...

When I call glEnable(GL_TEXTURE_2D) to do some stuff, it gives me a EXC_BAD_ACCESS warning - but if the AGL Window is never getting release'd, then shouldn't it exist? Setting set objc-non-blocking-mode at (gdb) doesn't make the problem go away.

So I guess my question is WHAT IS UP WITH CARBON/COCOA/NSAutoreleasePool?

And... are there any resources for Objective-C++? Because crap like this keeps happening to me.

Thanks,

-Stephen

--- CODE ---

Test Draw Function

void Channel::frameDraw( const uint32_t frameID)
{
    eq::Channel::frameDraw( frameID );
            getWindow()->makeCurrent(false);
    glEnable(GL_TEXTURE_2D); // Throws Error Here
}

Make Current (Equalizer API from Eyescale)

void Window::makeCurrent( const bool useCache ) const
{
    if( useCache && getPipe()->isCurrent( this ))
        return;

    _osWindow->makeCurrent();
}

void AGLWindow::makeCurrent() const
{
    aglSetCurrentContext( _aglContext );
    AGLWindowIF::makeCurrent();

    if( _aglContext )
    {
        EQ_GL_ERROR( "After aglSetCurrentContext" );
    }
}

_aglContext is a valid memory location (i.e. not NULL) when I step through.

-S!

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about memory