[glib: 8/9] GWin32AppInfo: Instantiate ApplicationActivationManager out-of-process
- From: Luca Bacci <lbacci src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 8/9] GWin32AppInfo: Instantiate ApplicationActivationManager out-of-process
- Date: Sat, 27 Aug 2022 14:11:11 +0000 (UTC)
commit 53515197df535b46e501129a647a81b8b4f9a9b2
Author: Luca Bacci <luca bacci982 gmail com>
Date: Wed Jul 27 15:15:35 2022 +0200
GWin32AppInfo: Instantiate ApplicationActivationManager out-of-process
This is recommended on MSDN
gio/gwin32appinfo.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c
index 722f4660b8..89bd879c0b 100644
--- a/gio/gwin32appinfo.c
+++ b/gio/gwin32appinfo.c
@@ -4893,8 +4893,25 @@ g_win32_app_info_launch_uwp_internal (GWin32AppInfo *info,
goto cleanup;
}
+ /* It's best to instantiate ApplicationActivationManager out-of-proc,
+ * as documented on MSDN:
+ *
+ * An IApplicationActivationManager object creates a thread in its
+ * host process to serve any activated event arguments objects
+ * (LaunchActivatedEventArgs, FileActivatedEventArgs, and Protocol-
+ * ActivatedEventArgs) that are passed to the app. If the calling
+ * process is long-lived, you can create this object in-proc,
+ * based on the assumption that the event arguments will exist long
+ * enough for the target app to use them.
+ * However, if the calling process is spawned only to launch the
+ * target app, it should create the IApplicationActivationManager
+ * object out-of-process, by using CLSCTX_LOCAL_SERVER. This causes
+ * the object to be created in a Dllhost instance that automatically
+ * manages the object's lifetime based on outstanding references to
+ * the activated event argument objects.
+ */
hr = CoCreateInstance (&CLSID_ApplicationActivationManager, NULL,
- CLSCTX_INPROC_SERVER,
+ CLSCTX_LOCAL_SERVER,
&IID_IApplicationActivationManager, (void **) &paam);
if (FAILED (hr))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]