From c44a4716491bffac6f5fa3df028ca8e2fe979e68 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 13 May 2019 09:02:54 +0000 Subject: [PATCH] Win32: fix destruction order issue leading to crash on close. --- src/platform/guiwin.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/guiwin.cpp b/src/platform/guiwin.cpp index 2f5b3a3e..73da2daa 100644 --- a/src/platform/guiwin.cpp +++ b/src/platform/guiwin.cpp @@ -639,6 +639,10 @@ public: } ~WindowImplWin32() { + // Make sure any of our child windows get destroyed before we call DestroyWindow, or their + // own destructors may fail. + menuBar.reset(); + sscheck(DestroyWindow(hWindow)); #if defined(HAVE_SPACEWARE) if(hSpaceWare != SI_NO_HANDLE) {