示例#1
0
void StatusNotifier::cleanup()
{
    // Disable the loop
    data = NULL;

    // True if there was anything to abort
    bool abort = false;

    // Abort the update job, if any
    if(updateJob && !updateJob->isFinished())
    {
        updateJob->abort();
        abort = true;
    }

    // Abort any other job
    WatchList::iterator it;
    for(it = watchList.begin(); it != watchList.end(); it++)
    {
        JobInfoPtr job = it->second;
        if(job && !job->isFinished())
        {
            job->abort();
            abort = true;
        }
    }

    // Give jobs some time to finish. This is run after the main window
    // closes, so a delay before exiting won't disturb the user.
    if(abort)
        wxSleep(1);
}