From fc2efd0b8f55f3539c02de7e9fb70a71f73c8fa2 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 22 May 2026 23:22:12 +0900 Subject: [PATCH] Linux: suppress redundant already-running dialog When a second GUI process successfully notifies the running instance through the show-request FIFO, the handoff is not an error. Avoid showing the informational modal before exiting, and let the running instance restore the main window on any show request. Also initialize the GTK indicator menu item pointers to NULL and guard the show/hide label update, preventing a latent crash in SetBackgroundMode when the indicator menu has not been built (e.g. background task disabled in preferences) -- a path made more reachable by the FIFO timer now invoking SetBackgroundMode unconditionally on incoming show requests. Fixes #1447. Closes #1745. Refs #461. --- src/Main/Forms/MainFrame.cpp | 7 ++++++- src/Main/GraphicUserInterface.cpp | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index d6f82a84..df1b8f77 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -48,6 +48,11 @@ namespace VeraCrypt MainFrame::MainFrame (wxWindow* parent) : MainFrameBase (parent), #ifdef HAVE_INDICATORS indicator (NULL), + indicator_item_showhide (NULL), + indicator_item_mountfavorites (NULL), + indicator_item_dismountall (NULL), + indicator_item_prefs (NULL), + indicator_item_exit (NULL), #endif ListItemRightClickEventPending (false), SelectedItemIndex (-1), @@ -1445,7 +1450,7 @@ namespace VeraCrypt try { uint8 buf[128]; - if (read (ShowRequestFifo, buf, sizeof (buf)) > 0 && Gui->IsInBackgroundMode()) + if (read (ShowRequestFifo, buf, sizeof (buf)) > 0) Gui->SetBackgroundMode (false); } catch (...) diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp index 84a40eaf..3dd294d5 100644 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -1037,7 +1037,6 @@ namespace VeraCrypt if (write (showFifo, buf, 1) == 1) { close (showFifo); - Gui->ShowInfo (LangString["LINUX_VC_RUNNING_ALREADY"]); Application::SetExitCode (0); return false; } @@ -1872,7 +1871,9 @@ namespace VeraCrypt BackgroundMode = state; #ifdef HAVE_INDICATORS - gtk_menu_item_set_label ((GtkMenuItem*) ((MainFrame*) mMainFrame)->indicator_item_showhide, LangString[Gui->IsInBackgroundMode() ? "SHOW_TC" : "HIDE_TC"].mb_str()); + MainFrame *mainFrame = (MainFrame*) mMainFrame; + if (mainFrame->indicator_item_showhide) + gtk_menu_item_set_label ((GtkMenuItem*) mainFrame->indicator_item_showhide, LangString[Gui->IsInBackgroundMode() ? "SHOW_TC" : "HIDE_TC"].mb_str()); #endif }