Auto-call taskManager.taskDone() when run() ends
Create AbstractTaskDone at the beginning of run() so that it is destroyed when it goes out of scope (i.e. run() finishes). When AbstractTaskDone is destroyed, it calls
pCore->taskManager.taskDone(...)
so that we don't need to manually insert calls to taskDone() before every return statement. By calling it at the very end of the function, we ensure that taskDone() is not called too early, which can delete the AbstractTask before it actually finishes.
This MR supersedes !362 (closed)