Help the compiler not fuck up. If I keep the thread spawn in the constructor, optimizations will get rid of the if on "!fileToLoad.empty()" for some reason.
This commit is contained in:
@@ -10,10 +10,6 @@ KaizenGui::KaizenGui() noexcept : window("Kaizen", 800, 600), settingsWindow(win
|
||||
SDL_InitSubSystem(SDL_INIT_GAMEPAD);
|
||||
|
||||
SDL_AddGamepadMapping(gamecontrollerdb_str);
|
||||
|
||||
std::thread fileWorker(&KaizenGui::FileWorker, this);
|
||||
|
||||
fileWorker.detach();
|
||||
}
|
||||
|
||||
KaizenGui::~KaizenGui() {
|
||||
@@ -391,7 +387,7 @@ void KaizenGui::RenderUI() {
|
||||
fileDialogOpen = false;
|
||||
constexpr SDL_DialogFileFilter filters[] = {{"All files", "*"}, {"Nintendo 64 executable", "n64;z64;v64"}, {"Nintendo 64 executable archive", "rar;tar;zip;7z"}};
|
||||
SDL_ShowOpenFileDialog([](void *userdata, const char * const *filelist, int) {
|
||||
const auto kaizen = static_cast<KaizenGui*>(userdata);
|
||||
auto kaizen = static_cast<KaizenGui*>(userdata);
|
||||
|
||||
if (!filelist) {
|
||||
panic("An error occured: {}", SDL_GetError());
|
||||
@@ -405,6 +401,9 @@ void KaizenGui::RenderUI() {
|
||||
|
||||
kaizen->fileToLoad = *filelist;
|
||||
kaizen->shouldDisplaySpinner = true;
|
||||
|
||||
std::thread fileWorker(&KaizenGui::FileWorker, kaizen);
|
||||
fileWorker.detach();
|
||||
}, this, window.getHandle(), filters, 3, nullptr, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user