Hello,
I'm having memory woes.
I've got a C++ Library (Equalizer from Eyescale) and they use the Traversal Visitor Pattern to allow you to add new functionality to their classes.
I've finally figured out how it works, and I've got a Visitor that just returns the properties from one of the objects. (since I don't know how they're allocated).
so.
My little code does this:
So here's the problem.
eq::Window* w = channel->getWindow();
(gdb) print w
0x0
BUT If I do this:
(gdb) set objc-non-blocking-mode off
(gdb) print w=channel->getWindow()
0x300effb9
It returns an honest memory location, and sets w as verified in the Debugger window of XCode.
It does the same thing for osw.
I don't get it. Why would something work in (gdb) but not in the code?
The file is completely a cpp file, but it seems to be running in objc++, since I need to turn blocking off.
Help!? I feel like I'm missing some memory-management basic thing here, either with C++ or Obj-C. The code works fine when compiled in a c++ only application.
How can I set objc-non-blocking-mode off in the compiler?
Thanks,
Stephen Furlani
I'm having memory woes.
I've got a C++ Library (Equalizer from Eyescale) and they use the Traversal Visitor Pattern to allow you to add new functionality to their classes.
I've finally figured out how it works, and I've got a Visitor that just returns the properties from one of the objects. (since I don't know how they're allocated).
so.
My little code does this:
Code:
VisitorResult AGLContextVisitor::visit( Channel* channel )
{
// Search through Nodes, Pipes until we get to the right window.
// Add some code to make sure we find the right one?
// Not executing the following code as C++ in gdb?
eq::Window* w = channel->getWindow();
OSWindow* osw = w->getOSWindow();
AGLWindow* aw = (AGLWindow *)osw;
AGLContext agl_ctx = aw->getAGLContext();
this->setContext(agl_ctx);
return TRAVERSE_PRUNE;
}
So here's the problem.
eq::Window* w = channel->getWindow();
(gdb) print w
0x0
BUT If I do this:
(gdb) set objc-non-blocking-mode off
(gdb) print w=channel->getWindow()
0x300effb9
It returns an honest memory location, and sets w as verified in the Debugger window of XCode.
It does the same thing for osw.
I don't get it. Why would something work in (gdb) but not in the code?
The file is completely a cpp file, but it seems to be running in objc++, since I need to turn blocking off.
Help!? I feel like I'm missing some memory-management basic thing here, either with C++ or Obj-C. The code works fine when compiled in a c++ only application.
How can I set objc-non-blocking-mode off in the compiler?
Thanks,
Stephen Furlani