mirror of
https://github.com/microsoft/PowerToys
synced 2024-11-21 07:42:50 +00:00
[Settings]Fix crash caused by dangling thread (#35603)
* Fix crash caused by dangling thread * Fix process access to be able to WaitForSingleObject it
This commit is contained in:
parent
a0138cec5e
commit
83d3c85f3e
@ -625,7 +625,7 @@ void close_settings_window()
|
||||
if (g_settings_process_id != 0)
|
||||
{
|
||||
SetEvent(g_terminateSettingsEvent);
|
||||
wil::unique_handle proc{ OpenProcess(PROCESS_TERMINATE, false, g_settings_process_id) };
|
||||
wil::unique_handle proc{ OpenProcess(PROCESS_ALL_ACCESS, false, g_settings_process_id) };
|
||||
if (proc)
|
||||
{
|
||||
WaitForSingleObject(proc.get(), 1500);
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.UI.Dispatching;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
@ -14,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
public static void WaitForEventLoop(string eventName, Action callback)
|
||||
{
|
||||
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
||||
new Thread(() =>
|
||||
new Task(() =>
|
||||
{
|
||||
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName);
|
||||
while (true)
|
||||
|
Loading…
Reference in New Issue
Block a user