Skip to content

Commit

Permalink
fixed ticker cleanup after timeline destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
eilara committed Feb 15, 2012
1 parent 3534b91 commit 991c7ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions eg/tween_demo.cpp
Expand Up @@ -72,8 +72,10 @@ void test_Timeline() { // 4 tests
ok(ticker.last_now == 1, "tick 1 now");

timeline.tick(3);
ok(ticker.tick_count == 2, "tick 1 count");
ok(ticker.last_now == 3, "tick 1 now");
ok(ticker.tick_count == 2, "tick 3 count");
ok(ticker.last_now == 3, "tick 3 now");

timeline.unregister_ticker(&ticker);
}

// -----------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions src/Timeline.cpp
Expand Up @@ -11,11 +11,13 @@ typedef LinearTweenForm<int,1> LinearIntForm;
typedef LinearTweenForm<float,1> LinearFloatForm;

Timeline::Timeline() : tickers() {
for (set<ITicker*>::iterator it = tickers.begin(); it != tickers.end(); it++)
(*it)->stop();
}

Timeline::~Timeline() {
for (set<ITicker*>::iterator it = tickers.begin(); it != tickers.end(); it++) {
ITicker *ticker = *it;
ticker->stop();
}
}

void Timeline::register_ticker(ITicker *ticker) {
Expand Down

0 comments on commit 991c7ae

Please sign in to comment.