Skip to content

Commit 8333137

Browse files
committed
Update
1 parent 6f5bdee commit 8333137

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Files.App.Storage/Storables/WindowsStorage/WindowsFolderWatcher.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public WindowsFolderWatcher(WindowsFolder folder)
5151
WNDCLASSEXW wndClass = default;
5252
wndClass.cbSize = (uint)sizeof(WNDCLASSEXW);
5353
wndClass.lpfnWndProc = pfnWndProc;
54-
wndClass.hInstance = PInvoke.GetModuleHandle(default(PWSTR)); ;
54+
wndClass.hInstance = PInvoke.GetModuleHandle(default(PWSTR));
5555
wndClass.lpszClassName = pszClassName;
5656

5757
PInvoke.RegisterClassEx(&wndClass);
@@ -103,10 +103,7 @@ private unsafe LRESULT WndProc(HWND hWnd, uint uMessage, WPARAM wParam, LPARAM l
103103
break;
104104
case PInvoke.WM_DESTROY:
105105
{
106-
PInvoke.SHChangeNotifyDeregister(_registrationID);
107-
PInvoke.CoTaskMemFree(_pidl);
108-
PInvoke.CoUninitialize();
109-
PInvoke.PostQuitMessage(0);
106+
Dispose();
110107
}
111108
break;
112109
}
@@ -116,10 +113,16 @@ private unsafe LRESULT WndProc(HWND hWnd, uint uMessage, WPARAM wParam, LPARAM l
116113

117114
public void Dispose()
118115
{
116+
PInvoke.SHChangeNotifyDeregister(_registrationID);
117+
PInvoke.CoTaskMemFree(_pidl);
118+
PInvoke.CoUninitialize();
119+
PInvoke.PostQuitMessage(0);
119120
}
120121

121122
public ValueTask DisposeAsync()
122123
{
124+
Dispose();
125+
123126
return ValueTask.CompletedTask;
124127
}
125128
}

0 commit comments

Comments
 (0)