make ImguiModule safe to unload
This commit is contained in:
@@ -191,7 +191,7 @@ namespace Archimedes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Successfully unloaded module: " << name << std::endl << "runOrder.empty(): " << runOrder.empty() << std::endl;
|
std::cout << "Successfully unloaded module: " << name << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void printHelp() = 0;
|
virtual void printHelp() = 0;
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ ImguiModule::ImguiModule(Archimedes::App* a, void* h = nullptr) : Archimedes::Mo
|
|||||||
|
|
||||||
ImguiModule::~ImguiModule() {
|
ImguiModule::~ImguiModule() {
|
||||||
|
|
||||||
|
WindowModule* wm = (WindowModule*) moduleInstances["WindowModule"];
|
||||||
|
wm->getRenderer()->getCmdList().erase(rcmd_it);
|
||||||
|
|
||||||
ImGui_ImplOpenGL3_Shutdown();
|
ImGui_ImplOpenGL3_Shutdown();
|
||||||
ImGui_ImplGlfw_Shutdown();
|
ImGui_ImplGlfw_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
@@ -61,6 +64,8 @@ void ImguiModule::onLoad() {
|
|||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rcmd_it = --wm->getRenderer()->getCmdList().end()++;
|
||||||
|
|
||||||
//Compute first frame ahead of first WindowModule->run()
|
//Compute first frame ahead of first WindowModule->run()
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ class ImguiModule : public Archimedes::Module {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
ImGuiContext* context;
|
ImGuiContext* context;
|
||||||
|
|
||||||
|
std::list<std::function<void()>>::iterator rcmd_it;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef IMGUIMODULE_DYNAMIC
|
#ifdef IMGUIMODULE_DYNAMIC
|
||||||
|
|||||||
Reference in New Issue
Block a user