Skip to content

Commit

Permalink
Fix crash Stop and pNext (#15)
Browse files Browse the repository at this point in the history
Crash occurs if you make a Stop and then a Start.
Then you should check if it's really running.

Set NULL in pNext pointer to avoid junk.
  • Loading branch information
rudacs authored and Makuna committed Feb 27, 2017
1 parent 91995db commit 399f110
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class Task
Task(uint32_t timeInterval) :
_timeInterval(timeInterval),
_remainingTime(0),
_taskState(TaskState_Stopped)
_taskState(TaskState_Stopped),
_pNext(NULL)
{
}

Expand Down Expand Up @@ -102,8 +103,11 @@ class Task
}
void Stop()
{
OnStop();
_taskState = TaskState_Stopping;
if (_taskState == TaskState_Running)
{
OnStop();
_taskState = TaskState_Stopping;
}
}
};

Expand Down

0 comments on commit 399f110

Please sign in to comment.