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.
This commit is contained in:
Mounir IDRASSI
2026-05-22 23:22:12 +09:00
parent d1f73ce429
commit fc2efd0b8f
2 changed files with 9 additions and 3 deletions

View File

@@ -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 (...)

View File

@@ -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
}