reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 3606a08b13e5d424d41c314ed3eb78f6169800fa
parent 056935e7102225c8aebd93501aad32cabc153f9b
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Sun, 12 Jan 2020 16:06:26 -0500

don't destroy modal dialogs twice

Fix a crash on Catalina introduced in a recent SWELL update when closing
the repository import window and network settings.

Diffstat:
Msrc/dialog.cpp | 16+++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/dialog.cpp b/src/dialog.cpp @@ -119,13 +119,15 @@ Dialog::~Dialog() for(const int id : m_timers) KillTimer(m_handle, id); // not using stopTimer to avoid modifying m_timers - // Unregistering the instance right now before DestroyWindow prevents WM_DESTROY - // from calling the default implementation of onClose (because we're in the - // destructor – no polymorphism here). Instead, the right onClose is called - // directly by close() for modeless dialogs, or by the OS/SWELL for modal dialogs. - SetWindowLongPtr(m_handle, GWLP_USERDATA, 0); - - DestroyWindow(m_handle); + if(m_mode == Modeless) { + // Unregistering the instance pointer right now before DestroyWindow + // prevents WM_DESTROY from calling the default implementation of onClose + // (because we're in the destructor – no polymorphism allowed here). + // Instead, the right onClose has been called directly by close() for + // modeless dialogs, or by the OS/SWELL for modal dialogs. + SetWindowLongPtr(m_handle, GWLP_USERDATA, 0); + DestroyWindow(m_handle); + } } INT_PTR Dialog::init(REAPER_PLUGIN_HINSTANCE inst, HWND parent, Modality mode)