In my program i have many dialogs, which actions depends on if data from database are downloaded correctly. If some error occurs i don't want to event show dialog. I tried something like this:

Qt Code:
  1. /* dialog constructor*/
  2. if(error)
  3. this->reject();
To copy to clipboard, switch view to plain text mode 

but it doesn't work. Then i found something like this:

Qt Code:
  1. /* dialog constructor*/
  2. if(error)
  3. QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
To copy to clipboard, switch view to plain text mode 

I read something about this method, but actually i'm still not sure if it's safe for my program. How it works? After invoking this method, my class destructor will be called to release allocated memory? If not, how can i achieve that?