diff options
-rw-r--r-- | base/message_loop.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc index fbdc94f..4c91b1f 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -372,10 +372,8 @@ bool MessageLoop::DeletePendingTasks() { // TODO(darin): Delete all tasks once it is safe to do so. // Until it is totally safe, just do it when running Purify or // Valgrind. -#if defined(OS_WIN) -#ifdef PURIFY +#if defined(PURIFY) delete pending_task.task; -#endif // PURIFY #elif defined(OS_POSIX) if (RUNNING_ON_VALGRIND) delete pending_task.task; @@ -385,14 +383,17 @@ bool MessageLoop::DeletePendingTasks() { did_work |= !deferred_non_nestable_work_queue_.empty(); while (!deferred_non_nestable_work_queue_.empty()) { // TODO(darin): Delete all tasks once it is safe to do so. - // Until it is totaly safe, just delete them to keep purify happy. -#ifdef PURIFY - Task* task = deferred_non_nestable_work_queue_.front().task; + // Until it is totaly safe, only delete them under Purify and Valgrind. + Task* task = NULL; +#if defined(PURIFY) + task = deferred_non_nestable_work_queue_.front().task; +#elif defined(OS_POSIX) + if (RUNNING_ON_VALGRIND) + task = deferred_non_nestable_work_queue_.front().task; #endif deferred_non_nestable_work_queue_.pop(); -#ifdef PURIFY - delete task; -#endif + if (task) + delete task; } did_work |= !delayed_work_queue_.empty(); while (!delayed_work_queue_.empty()) { |