diff --git a/src/shell/actions/drag_out_win.cpp b/src/shell/actions/drag_out_win.cpp index cc07a15..1e5c661 100644 --- a/src/shell/actions/drag_out_win.cpp +++ b/src/shell/actions/drag_out_win.cpp @@ -378,8 +378,8 @@ ui::WindowFacts windowFacts(HWND hwnd) { bool pointerOverPluginEditor(int screenX, int screenY) { // The CLASS procedure's module rather than the window's hInstance: a bare-SDK plugin may - // create its editor with the hInstance of the parent REAPER hands it (ReaSampler 9000's own - // editor does), so hInstance would read that plugin as REAPER. + // create its editor with the hInstance of the parent REAPER hands it, so hInstance would + // read that plugin as REAPER. const POINT pt{screenX, screenY}; const HWND hit = WindowFromPoint(pt); if (!hit) return false; diff --git a/src/shell/instrument/editor_platform.cpp b/src/shell/instrument/editor_platform.cpp index 73080e1..d13dda5 100644 --- a/src/shell/instrument/editor_platform.cpp +++ b/src/shell/instrument/editor_platform.cpp @@ -36,10 +36,10 @@ const std::wstring& childClassName() { // The module holding a given code address — used to resolve THIS wndProc's own module rather // than the parent's hInstance REAPER hands us. Registering against the parent would put the class -// in REAPER's own module, where a second .vst3 (the other channel) sharing that hInstance could -// collide on the (now channel-forked) name, and any lookup-by-class would resolve into the wrong -// binary. Takes the address rather than naming wndProc directly so a free function in this -// anonymous namespace doesn't need access to the private member. +// in REAPER's own module while the wndproc still points into our DLL — a dangling procedure +// pointer once our DLL unloads but REAPER's class registration outlives it. Takes the address +// rather than naming wndProc directly so a free function in this anonymous namespace doesn't need +// access to the private member. HMODULE moduleHandleFor(void* codeAddress) { HMODULE mod = nullptr; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | diff --git a/tests/test_window_origin.cpp b/tests/test_window_origin.cpp index 0d942ec..d81fb77 100644 --- a/tests/test_window_origin.cpp +++ b/tests/test_window_origin.cpp @@ -194,6 +194,18 @@ static void testOwnModulePathStableAndBetaDoNotMatchEachOther() { CHECK(!isOwnModulePath("C:\\VST3\\reasampler_9000.vst3", "reasampler_9000_beta.vst3")); } +static void testOwnModulePathBareFilenameWithNoSeparatorMatches() { + CHECK(isOwnModulePath("reasampler_9000.vst3", "reasampler_9000.vst3")); +} + +static void testOwnModulePathEmptyPathDoesNotMatch() { + CHECK(!isOwnModulePath("", "reasampler_9000.vst3")); +} + +static void testOwnModulePathTrailingSeparatorDoesNotMatch() { + CHECK(!isOwnModulePath("C:\\VST3\\reasampler_9000.vst3\\", "reasampler_9000.vst3")); +} + int main() { testHostExecutableIsHost(); testOsModulesAreSystem(); @@ -216,6 +228,9 @@ int main() { testOwnModulePathCaseFolds(); testOwnModulePathBundlePathForwardAndBackSlash(); testOwnModulePathStableAndBetaDoNotMatchEachOther(); + testOwnModulePathBareFilenameWithNoSeparatorMatches(); + testOwnModulePathEmptyPathDoesNotMatch(); + testOwnModulePathTrailingSeparatorDoesNotMatch(); if (g_fail == 0) std::printf("All tests passed.\n"); return g_fail ? 1 : 0;