From 14475762b84f12213a2d0d905fa3f2fee08d85b3 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 3 Aug 2018 18:36:35 +0800 Subject: [PATCH] Flush all command before delete world --- src/main_loop.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main_loop.cpp b/src/main_loop.cpp index fac14411c..e093c5229 100644 --- a/src/main_loop.cpp +++ b/src/main_loop.cpp @@ -21,8 +21,10 @@ #include "audio/sfx_manager.hpp" #include "config/user_config.hpp" +#include "graphics/central_settings.hpp" #include "graphics/irr_driver.hpp" #include "graphics/material_manager.hpp" +#include "graphics/sp/sp_texture_manager.hpp" #include "guiengine/engine.hpp" #include "guiengine/message_queue.hpp" #include "guiengine/modaldialog.hpp" @@ -339,6 +341,19 @@ void MainLoop::run() STKHost::get()->shutdown(); // In case the user opened a race pause dialog GUIEngine::ModalDialog::dismiss(); + +#ifndef SERVER_ONLY + if (CVS->isGLSL()) + { + // Flush all command before delete world, avoid later access + SP::SPTextureManager::get() + ->checkForGLCommand(true/*before_scene*/); + // Reset screen in case the minimap was drawn + glViewport(0, 0, irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height); + } +#endif + if (World::getWorld()) { race_manager->clearNetworkGrandPrixResult();