On 17/03/14 11:44, Anton Gladky wrote:
> 2014-03-17 9:23 GMT+01:00 Bruno Chareyre <[email protected]>:
>> +       if(manipulatedFrame()==0) setManipulatedFrame(new 
>> qglviewer::ManipulatedFrame());
>>
>> It sounds like a memory leak. No?
> I believe no. It just checks,  whether manipulatedFrame exists and
> creates a new one, if it is not. Otherwise we get segfault on new
> QGLViewer.

IIRC, c++ textbooks teach us to always write a "delete" when we write a
"new".
In this case I don't see where this new manipulated frame would be deleted.
I can't imagine a big loss of memory unless someone repeatdly close/open
QGL view (and even in that case, not sure it would create a new frame
each time), but it is still a strange line.
It would be better to not manipulate when manipulatedFrame()==0, it
seems, since manipulating a standalone frame that is not displayed (the
"new" one) is always useless.

Bruno

_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to