mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
fix: Make sure all textures are destroyed before glfw gets uninitialized
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <init/run.hpp>
|
||||
#include <window.hpp>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace hex::init {
|
||||
|
||||
int runImHex() {
|
||||
@@ -27,14 +29,22 @@
|
||||
handleFileOpenRequest();
|
||||
}
|
||||
|
||||
// Main window
|
||||
{
|
||||
Window window;
|
||||
window.loop();
|
||||
// Initialize GLFW
|
||||
if (!glfwInit()) {
|
||||
log::fatal("Failed to initialize GLFW!");
|
||||
std::abort();
|
||||
}
|
||||
ON_SCOPE_EXIT { glfwTerminate(); };
|
||||
|
||||
// Main window
|
||||
{
|
||||
Window window;
|
||||
window.loop();
|
||||
}
|
||||
|
||||
deinitializeImHex();
|
||||
}
|
||||
|
||||
deinitializeImHex();
|
||||
|
||||
} while (shouldRestart);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/events/requests_lifecycle.hpp>
|
||||
@@ -49,9 +50,12 @@
|
||||
|
||||
emscripten_cancel_main_loop();
|
||||
|
||||
ON_SCOPE_EXIT { glfwTerminate(); };
|
||||
|
||||
try {
|
||||
saveFsData();
|
||||
deinitializeImHex();
|
||||
|
||||
return "";
|
||||
} catch (const std::exception &e) {
|
||||
static std::string message;
|
||||
@@ -65,6 +69,12 @@
|
||||
|
||||
emscripten_cancel_main_loop();
|
||||
|
||||
// Initialize GLFW
|
||||
if (!glfwInit()) {
|
||||
log::fatal("Failed to initialize GLFW!");
|
||||
std::abort();
|
||||
}
|
||||
|
||||
// Main window
|
||||
static std::optional<Window> window;
|
||||
window.emplace();
|
||||
|
||||
Reference in New Issue
Block a user