mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
fix assertion error after long delay
This commit is contained in:
parent
55455a48c9
commit
57f10c8a37
@ -588,8 +588,15 @@ choose_next_context(struct ThreadContext *from_context) {
|
|||||||
}
|
}
|
||||||
TickRecord &record = _tick_records.front();
|
TickRecord &record = _tick_records.front();
|
||||||
_total_ticks -= record._tick_count;
|
_total_ticks -= record._tick_count;
|
||||||
nassertv(record._thread->_run_ticks >= record._tick_count);
|
|
||||||
record._thread->_run_ticks -= record._tick_count;
|
if (record._thread->_run_ticks >= record._tick_count) {
|
||||||
|
// Ensure we don't go negative.
|
||||||
|
record._thread->_run_ticks -= record._tick_count;
|
||||||
|
} else {
|
||||||
|
// It is possible for this to happen if the application has been
|
||||||
|
// paused for more than 2^31 ticks.
|
||||||
|
record._thread->_run_ticks = 0;
|
||||||
|
}
|
||||||
_tick_records.pop_front();
|
_tick_records.pop_front();
|
||||||
}
|
}
|
||||||
new_epoch = true;
|
new_epoch = true;
|
||||||
@ -724,8 +731,14 @@ do_timeslice_accounting(ThreadSimpleImpl *thread, double now) {
|
|||||||
nassertv(!_tick_records.empty());
|
nassertv(!_tick_records.empty());
|
||||||
TickRecord &record = _tick_records.front();
|
TickRecord &record = _tick_records.front();
|
||||||
_total_ticks -= record._tick_count;
|
_total_ticks -= record._tick_count;
|
||||||
nassertv(record._thread->_run_ticks >= record._tick_count);
|
if (record._thread->_run_ticks >= record._tick_count) {
|
||||||
record._thread->_run_ticks -= record._tick_count;
|
// Ensure we don't go negative.
|
||||||
|
record._thread->_run_ticks -= record._tick_count;
|
||||||
|
} else {
|
||||||
|
// It is possible for this to happen if the application has been
|
||||||
|
// paused for more than 2^31 ticks.
|
||||||
|
record._thread->_run_ticks = 0;
|
||||||
|
}
|
||||||
_tick_records.pop_front();
|
_tick_records.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user