Bug of nArray, call destructor over nonexistent objects

View: New views
2 Messages — Rating Filter:   Alert me  

Bug of nArray, call destructor over nonexistent objects

by ZHANG Zikai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

write a piece of code like this:
    {
        nArray<nDynAutoRef<nReferenced> > array;
        nDynAutoRef<nReferenced> a;
        a.set("Hello world!");
        array.Append(a);
        array.Append(a);
        array.Erase(0);
    }
this will crash inside the nArray::Delete. Since nArray alloc elements
by new [] and clean by delete [], constractor/destructor will be
called over nonexistent objects.

dectructor of nDynAutoRef just free its string but not set the pointer
to 0 and fall into nArray's trap :-(

We can temporarily correct the problem by set nDynAutoRef's pointer to
0, but it will be better to correct nArray.

btw, I met the problem when I trying to RemoveAnimator from nSceneNode.

kaikai

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: Bug of nArray, call destructor over nonexistent objects

by Kim, Hyoun Woo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

It would be appreciate if you can post this bug on the bugzilla with the patch.
So we can fix it.

Thanks for pointing it out.


Cheers,


Kim, Hyoun Woo


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss