Repository navigation
Conversation
zhangzhend0ng
left a comment
There was a problem hiding this comment.
Review: impact scope & regression risk — non-blocking findings
The fix itself is verified correct: the title producer Plater.cpp:16407 sets " - Snapmaker Orca" (space) while the old matcher searched for the underscore variant; the second-instance lifecycle is unchanged (send_message's return value is ignored at InstanceCheck.cpp:361 — the wxSingleInstanceChecker mutex alone decides termination); and the WM_COPYDATA receiver (GUI_App.cpp:834) was already registered, so no new attack surface. Impact is limited to users with app/single_instance=true (default false).
Non-blocking findings in priority order (two more anchored inline on the changed line):
-
Plater.cpp:16407— title producer still hardcoded (one line, this PR or follow-up). The matcher now derives fromSLIC3R_APP_NAMEwhile the producer is a literal; they coincide today, and renaming either side resurrects this exact bug. SuggestSetTitle(m_project_name + " - " + SLIC3R_APP_NAME). -
MainFrame.cpp:240— empty title during early startup (record only). The main frame is constructed with an empty title and only gets the app name viaPlater::priv::set_project_name, so during that brief startup window a second instance still cannot forward. Pre-existing behavior, unchanged by this PR. -
Root-cure follow-up: sync upstream's approach. Upstream SoftFever/OrcaSlicer removed title matching entirely — their
EnumWindowsProcmatches classwxWindowNR+ presence ofInstance_Hash_Minor/Majorwindow props + hash equality (props are set only on the real main frame). That decouples instance detection from branding strings and also eliminates the Settings-dialog over-match noted inline.
| std::wstring wndTextString(wndText); | ||
| if (wndTextString.find(L"Snapmaker_Orca") != std::wstring::npos && classNameString == L"wxWindowNR") { | ||
| static const std::wstring app_name = boost::nowide::widen(SLIC3R_APP_NAME); | ||
| if (wndTextString.find(app_name) != std::wstring::npos && classNameString == L"wxWindowNR") { |
There was a problem hiding this comment.
Non-blocking, but worth one line in this PR: now that the window is actually found, the unconditional ShowWindow(hwnd, SW_SHOWMAXIMIZED) further down in this callback (~line 126) becomes live behavior: every second launch that forwards a file force-maximizes the running instance's window, even if the user had it restored or snapped. Upstream OrcaSlicer deliberately softened this:
// Do not alter the window state when opening a file in the existing instance.
// A minimized window still needs restoring before it can receive focus.
if (IsIconic(hwnd))
ShowWindow(hwnd, SW_RESTORE);
SetForegroundWindow(hwnd);Suggest adopting the same (SetForegroundWindow stays as-is).
| std::wstring wndTextString(wndText); | ||
| if (wndTextString.find(L"Snapmaker_Orca") != std::wstring::npos && classNameString == L"wxWindowNR") { | ||
| static const std::wstring app_name = boost::nowide::widen(SLIC3R_APP_NAME); | ||
| if (wndTextString.find(app_name) != std::wstring::npos && classNameString == L"wxWindowNR") { |
There was a problem hiding this comment.
Non-blocking, record: with the substring now matching, any top-level wxWindowNR window whose title contains the app name gets probed — including our own Settings dialog (SLIC3R_APP_NAME + " - " + _L("Settings"), MainFrame.cpp:4309). The instance-hash guard handles it correctly (GetProp returns NULL → hash 0 ≠ real instance hash → "win enum - found wrong instance" debug log and enumeration continues), so this is log noise only, no functional risk. It disappears if a follow-up adopts upstream's GetProp-based matching (no title string involved at all).
|
Addressed both actionable findings in 2b83e3b:
Thanks for the review! The |
Description
Fixes #605.
On Windows, when "Allow only one Snapmaker Orca instance" is enabled and the app is already running, launching the executable again with a model file (double-clicking an STL/3MF, or exporting from Fusion) terminated the second process without forwarding the file path.
Root cause:
EnumWindowsProcinsrc/slic3r/GUI/InstanceCheck.cppsearched for a main window whose title containsSnapmaker_Orca(underscore), but the Windows main frame title is set inPlater::priv::set_project_nameas"<project> - Snapmaker Orca"(space). The primary window was therefore never found,WM_COPYDATAwas never delivered, and the command line was dropped silently.Fix: match the title against
SLIC3R_APP_NAMEinstead of a hardcoded string, so the window search stays in sync with the branded title.Screenshots/Recordings/Graphs
Not applicable (no UI change).
Tests
win enum - found correct instance.