Hi Robert, I see no problems with your solution. Thanks for the review.
Alex ------------------------------ Message: 5 Date: Wed, 14 Sep 2011 11:45:02 +0100 From: Robert Osfield <[email protected]> To: OpenSceneGraph Submissions <[email protected]> Subject: Re: [osg-submissions] Fix for memory leak in osgviewerWX example Message-ID: <cafn7y+u-zuqygeucpsfs7xi7r4hm-miridcqvjyzxl57hkx...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Hi Alex, The code looks to be written on the assumption that wxWidgets would take ownership of the data structure, but look at inline docs I can't see clarification of this. From your findings with the memory leak it would suggest that is assumes that the calling code will take responsibility for the data structures destruction. I've reviewed you code and feel that it would be more straight forward to replace the new int[7] with a stack based allocated which wouldn't need any delete [] call. I've tried the following at it compiles and runs just fine: int attributes[7]; attributes[0] = int(WX_GL_DOUBLEBUFFER); attributes[1] = WX_GL_RGBA; attributes[2] = WX_GL_DEPTH_SIZE; attributes[3] = 8; attributes[4] = WX_GL_STENCIL_SIZE; attributes[5] = 8; attributes[6] = 0; OSGCanvas *canvas = new OSGCanvas(frame, wxID_ANY, wxDefaultPosition, wxSize(width, height), wxSUNKEN_BORDER, wxT("osgviewerWX"), attributes); Can you see any problem with this? Robert. This communication, along with any attachments, is covered by federal and state law governing electronic communications and may contain company proprietary and legally privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, use or copying of this message is strictly prohibited. If you have received this in error, please reply immediately to the sender and delete this message. Thank you. _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
