From cf67f540f38d28421a7335f58423472a25f707b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sch=C3=B6n?= Date: Wed, 8 Jun 2022 18:29:12 +0200 Subject: [PATCH] bugfix: update application stuck when "Show on system tray" is active --- src/MainForm.cs | 3 ++- src/UpdateForm.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MainForm.cs b/src/MainForm.cs index 159a6e9..45e4904 100644 --- a/src/MainForm.cs +++ b/src/MainForm.cs @@ -679,7 +679,8 @@ namespace MeshCentralRouter { if (this.InvokeRequired) { this.Invoke(new MeshCentralServer.toolUpdateHandler(Meshcentral_onToolUpdate), url, hash, size, serverhash); return; } UpdateForm f = new UpdateForm(url, hash, size, args, serverhash); - if (f.ShowDialog(this) == DialogResult.OK) { } + forceExit = true; + if (f.ShowDialog(this) != DialogResult.OK) { forceExit = !notifyIcon.Visible; } } private void Meshcentral_onLoginTokenChanged() diff --git a/src/UpdateForm.cs b/src/UpdateForm.cs index 5629b8c..5c3753f 100644 --- a/src/UpdateForm.cs +++ b/src/UpdateForm.cs @@ -140,7 +140,8 @@ namespace MeshCentralRouter } else { updateMessage(Translate.T(Properties.Resources.Updating), 0); Process.Start(System.Reflection.Assembly.GetEntryAssembly().Location + ".update.exe", "-update:" + System.Reflection.Assembly.GetEntryAssembly().Location + " " + string.Join(" ", args)); - Application.Exit(); + + if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { Application.Exit(); }); } else { Application.Exit(); } } } }