TheSwamp

Code Red => ARX Programming => Topic started by: lethuongtri on June 06, 2022, 03:11:31 AM

Title: Using smartPointer variables in class
Post by: lethuongtri on June 06, 2022, 03:11:31 AM
Goodeverning everybody, i'm learning ObjectARX and i got a question.

So i have a class definition like image[1]

then inside this class a have AcDbObjectPointer<AcDbLine> variables and i do not declare the class destructor( use default)

In the command.cpp file, i created instance of above class like Image[2]

so , my question is when "panelObj" come out of its scope . all object controled by above smartpointers is auto close(Database object) / delete (not database object)  ?

And this way is safe from memory leak ?

Thank you in advance!
Title: Re: Using smartPointer variables in class
Post by: It's Alive! on June 06, 2022, 10:28:48 AM
Yeah, the smart pointers will handle closing/deleting the entities.
Title: Re: Using smartPointer variables in class
Post by: lethuongtri on June 06, 2022, 06:54:00 PM
yes,I got it. Thanks for your reply.