diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:54:34 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:54:34 +0200 |
commit | 96e20826f358a32e38c3f052243375982543c05b (patch) | |
tree | 691efa86265fbb35cc60a1ce816423bb2a41f17b /zen/notify_removal.cpp | |
parent | 6.13 (diff) | |
download | FreeFileSync-96e20826f358a32e38c3f052243375982543c05b.tar.gz FreeFileSync-96e20826f358a32e38c3f052243375982543c05b.tar.bz2 FreeFileSync-96e20826f358a32e38c3f052243375982543c05b.zip |
6.14
Diffstat (limited to 'zen/notify_removal.cpp')
-rw-r--r-- | zen/notify_removal.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/zen/notify_removal.cpp b/zen/notify_removal.cpp index 37f305c9..f528e81b 100644 --- a/zen/notify_removal.cpp +++ b/zen/notify_removal.cpp @@ -86,7 +86,7 @@ MessageProvider::MessageProvider() : if (::RegisterClass(&wc) == 0) throwFileError(_("Unable to register to receive system messages."), L"RegisterClass", getLastError()); - ScopeGuard guardClass = makeGuard([&] { ::UnregisterClass(dummyClassName, hMainModule); }); + ScopeGuard guardConstructor = zen::makeGuard([&] { this->~MessageProvider(); }); //create dummy-window windowHandle = ::CreateWindow(dummyClassName, //_In_opt_ LPCTSTR lpClassName, @@ -106,14 +106,15 @@ MessageProvider::MessageProvider() : if (::SetWindowLongPtr(windowHandle, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)) == 0 && ::GetLastError() != ERROR_SUCCESS) throwFileError(_("Unable to register to receive system messages."), L"SetWindowLongPtr", ::GetLastError()); - guardClass.dismiss(); + guardConstructor.dismiss(); } MessageProvider::~MessageProvider() { //clean-up in reverse order - ::DestroyWindow(windowHandle); + if (windowHandle) + ::DestroyWindow(windowHandle); ::UnregisterClass(dummyClassName, //LPCTSTR lpClassName OR ATOM in low-order word! hMainModule); //HINSTANCE hInstance } |