mangoapp: iconify/restore the window, don't destroy it

Currently we're destroying the window, from under the glfw's framework
feet.

Basically we do a use-after-free, as glfwWindowShouldClose() is called
and due to some miracle we don't crash out.

Since we suspend all rendering, there's no need to actually destroy the
window - just iconify/restore it. A simple show/hide was attempted but
empirically did not work.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
pull/707/head
Emil Velikov 2 years ago committed by jackun
parent 40a1758518
commit 74e83c0bba
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -284,9 +284,7 @@ int main(int, char**)
while (!glfwWindowShouldClose(window)){
if (!params->no_display){
if (mangoapp_paused){
window = init(glsl_version);
create_fonts(*params, sw_stats.font1, sw_stats.font_text);
HUDElements.convert_colors(*params);
glfwRestoreWindow(window);
mangoapp_paused = false;
}
{
@ -322,7 +320,7 @@ int main(int, char**)
glfwSwapBuffers(window);
} else if (!mangoapp_paused) {
shutdown(window);
glfwIconifyWindow(window);
mangoapp_paused = true;
std::unique_lock<std::mutex> lk(mangoapp_m);
mangoapp_cv.wait(lk, []{return !params->no_display;});

Loading…
Cancel
Save