From e975c1625ae6aed74a7a369d52a96ecfb67131d2 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Sun, 30 Mar 2025 08:26:34 -0300 Subject: [PATCH] meson, app, build: Fix Inno wrongly allowing to unninstall with GIMP running Inno needs an AppMutex to be aware of GIMP execution so prevent unninstalling or installing GIMP if still running. (Unninstalling with GIMP running was making GIMP to not be fully unninstaled since gimp*.exe process file was opened. It also could cause problems with settings unninstall.) (Installing with GIMP running was already not possible since Inno code in that part is more refined but that check isn't done before deleting .debug files) --- app/main.c | 9 +++++++++ build/windows/installer/base_gimp3264.iss | 4 +++- meson.build | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/main.c b/app/main.c index 7a408d4733..deb63e833f 100644 --- a/app/main.c +++ b/app/main.c @@ -595,6 +595,15 @@ main (int argc, gimp_init_signal_handlers (&backtrace_file); #ifdef G_OS_WIN32 + /* Make Inno aware of gimp process avoiding broken install/unninstall */ + char *utf8_name = g_strdup_printf ("GIMP-%s", GIMP_MUTEX_VERSION); + wchar_t *name = g_utf8_to_utf16 (utf8_name, -1, NULL, NULL, NULL); + + CreateMutexW (NULL, FALSE, name); + + g_free (utf8_name); + g_free (name); + /* Enable Anti-Aliasing*/ g_setenv ("PANGOCAIRO_BACKEND", "fc", TRUE); diff --git a/build/windows/installer/base_gimp3264.iss b/build/windows/installer/base_gimp3264.iss index c4554b164a..f2a496709c 100644 --- a/build/windows/installer/base_gimp3264.iss +++ b/build/windows/installer/base_gimp3264.iss @@ -129,7 +129,9 @@ NotRecognizedMessagesWarning=no ;3.2.1 INNO INTERNAL VERSIONING (used to rule how different versions are installed) -;Inno installer identifier: https://github.com/jrsoftware/issrc/pull/461 +;GIMP process identifier for Inno +AppMutex=GIMP-{#GIMP_MUTEX_VERSION} +;Inno installer identifier SetupMutex=GIMP-{#GIMP_MUTEX_VERSION} ;Inno installer (default) install location DefaultDirName={autopf}\GIMP {#GIMP_MUTEX_VERSION} diff --git a/meson.build b/meson.build index c91e8fc97d..5a4cf56149 100644 --- a/meson.build +++ b/meson.build @@ -103,6 +103,13 @@ endif # GIMP_IS_GIT can only be set during development of a RC. conf.set('GIMP_IS_RC_GIT', gimp_rc_git ? 1 : false) +# Mutex version +if gimp_unstable != false + conf.set_quoted('GIMP_MUTEX_VERSION', gimp_app_version) +else + conf.set_quoted('GIMP_MUTEX_VERSION', gimp_app_version_major.to_string()) +endif + versionconfig = configuration_data() versionconfig.set('GIMP_FULL_NAME', full_name) versionconfig.set('GIMP_MAJOR_VERSION', gimp_app_version_major)