Hi! I usually do this to free a QProcess (or a QThread after it has finished):

Qt Code:
  1. QProcess* proc = new QProcess();
  2. connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater()));
To copy to clipboard, switch view to plain text mode 

and seems to work just fine, and I suppose is the correct way of freeing memory. Am I right?

Now, I find myself in the situation where I need to do something after the process has finished, but I also want to delete the pointer. Can I do this?

Qt Code:
  1. QProcess* proc = new QProcess();
  2. connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater()));
  3. connect(proc, SIGNAL(finished(int)), <some_pointer>, SLOT(doSomething()));
To copy to clipboard, switch view to plain text mode 

I tried this and it seems to work but I don't know if it is the correct way to go. If it isn't, what is the best solution?
Thanks!