Author Topic: Using smartPointer variables in class  (Read 225 times)

0 Members and 1 Guest are viewing this topic.

lethuongtri

  • Mosquito
  • Posts: 14
Using smartPointer variables in class
« 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!

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 7320
  • AKA Daniel
Re: Using smartPointer variables in class
« Reply #1 on: June 06, 2022, 10:28:48 AM »
Yeah, the smart pointers will handle closing/deleting the entities.
Retired

lethuongtri

  • Mosquito
  • Posts: 14
Re: Using smartPointer variables in class
« Reply #2 on: June 06, 2022, 06:54:00 PM »
yes,I got it. Thanks for your reply.