Staging: Avoid leaking staging_event for every thread.

Just leak it for the first one.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57989
This commit is contained in:
Elizabeth Figura
2025-03-20 22:20:53 -05:00
parent bb826f2185
commit 30f69aa45a

View File

@@ -1,15 +1,15 @@
From 601da0ae0c6b22f37d20e6e0f10558093277eca9 Mon Sep 17 00:00:00 2001
From 3dc4a148d7c91afea8f589f47daca82c5c27b7c1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 2 Oct 2014 19:44:31 +0200
Subject: [PATCH] ntdll: Print a warning message specifying the wine-staging
branch name and version.
---
dlls/ntdll/loader.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
dlls/ntdll/loader.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 5f84ca7e23b..fabf394fbe5 100644
index 74eb1b7f500..95639558155 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -43,6 +43,7 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
@@ -20,7 +20,7 @@ index 5f84ca7e23b..fabf394fbe5 100644
#ifdef _WIN64
#define DEFAULT_SECURITY_COOKIE_64 (((ULONGLONG)0x00002b99 << 32) | 0x2ddfa232)
@@ -3828,6 +3829,7 @@ void WINAPI LdrShutdownProcess(void)
@@ -3870,6 +3871,7 @@ void WINAPI LdrShutdownProcess(void)
process_detach();
}
@@ -28,7 +28,7 @@ index 5f84ca7e23b..fabf394fbe5 100644
/******************************************************************
* RtlExitUserProcess (NTDLL.@)
@@ -4322,6 +4324,9 @@ static void release_address_space(void)
@@ -4366,6 +4368,9 @@ static void release_address_space(void)
*/
void loader_init( CONTEXT *context, void **entry )
{
@@ -38,13 +38,13 @@ index 5f84ca7e23b..fabf394fbe5 100644
static int attach_done;
NTSTATUS status;
ULONG_PTR cookie, port = 0;
@@ -4407,7 +4412,18 @@ void loader_init( CONTEXT *context, void **entry )
@@ -4455,6 +4460,20 @@ void loader_init( CONTEXT *context, void **entry )
arm64ec_thread_init();
#endif
wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
+ /* This hunk occasionally applies in the wrong place;
+ * add a comment here to try to prevent that. */
}
+ }
+ RtlInitUnicodeString( &staging_event_string, L"\\__wine_staging_warn_event" );
+ InitializeObjectAttributes( &staging_event_attr, &staging_event_string, OBJ_OPENIF, NULL, NULL );
+ if (NtCreateEvent( &staging_event, EVENT_ALL_ACCESS, &staging_event_attr, NotificationEvent, FALSE ) == STATUS_SUCCESS)
@@ -53,10 +53,12 @@ index 5f84ca7e23b..fabf394fbe5 100644
+ FIXME_(winediag)("Please mention your exact version when filing bug reports on winehq.org.\n");
+ }
+ else
+ {
+ WARN_(winediag)("wine-staging %s is a testing version containing experimental patches.\n", wine_get_version());
+ NtClose( staging_event );
}
NtCurrentTeb()->FlsSlots = fls_alloc_data();
--
2.45.2
2.47.2