void Task::run() { TaskManager* pOwner = getOwner(); if (pOwner) pOwner->taskStarted(this); try { _state = TASK_RUNNING; runTask(); } catch (Exception& exc) { if (pOwner) pOwner->taskFailed(this, exc); } catch (std::exception& exc) { if (pOwner) pOwner->taskFailed(this, SystemException(exc.what())); } catch (...) { if (pOwner) pOwner->taskFailed(this, SystemException("unknown exception")); } _state = TASK_FINISHED; if (pOwner) pOwner->taskFinished(this); }