From a837138dfcbbcfb2b60c12eca47f1f7c6d4e62db Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Mon, 11 Dec 2023 15:51:55 +0900 Subject: [PATCH] [SHIMGVW] Destroy window to exit app in Preview_Edit CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index fc3bbdbf2ec..cf62ba202ee 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -905,6 +905,14 @@ Preview_Edit(HWND hwnd) if (!g_pCurrentFile) return; + /* Avoid file locking */ + /* FIXME: Our GdipLoadImageFromFile locks the image file */ + if (g_pImage) + { + GdipDisposeImage(g_pImage); + g_pImage = NULL; + } + GetFullPathNameW(g_pCurrentFile->FileName, _countof(szPathName), szPathName, NULL); szPathName[_countof(szPathName) - 1] = UNICODE_NULL; /* Avoid buffer overrun */ @@ -917,6 +925,9 @@ Preview_Edit(HWND hwnd) { DPRINT1("Preview_Edit: ShellExecuteExW() failed with code %ld\n", GetLastError()); } + + // Destroy the window to quit the application + DestroyWindow(hwnd); } static VOID