display: fix assert when app exits before window fully opens

Possibly addressing #403
This commit is contained in:
rdb 2018-10-07 21:41:02 +02:00
parent 86c9d11a53
commit b0c9000000
1 changed files with 9 additions and 2 deletions

View File

@ -593,8 +593,7 @@ remove_all_windows() {
Windows old_windows;
old_windows.swap(_windows);
Windows::iterator wi;
for (wi = old_windows.begin(); wi != old_windows.end(); ++wi) {
GraphicsOutput *win = (*wi);
for (GraphicsOutput *win : old_windows) {
nassertv(win != nullptr);
do_remove_window(win, current_thread);
GraphicsStateGuardian *gsg = win->get_gsg();
@ -605,6 +604,14 @@ remove_all_windows() {
{
MutexHolder new_windows_holder(_new_windows_lock, current_thread);
for (GraphicsOutput *win : _new_windows) {
nassertv(win != nullptr);
do_remove_window(win, current_thread);
GraphicsStateGuardian *gsg = win->get_gsg();
if (gsg != nullptr) {
gsg->release_all();
}
}
_new_windows.clear();
}