Skip to content
This repository was archived by the owner on May 2, 2022. It is now read-only.

Commit 8ea6862

Browse files
committedJun 10, 2021
fix(windows): crash on destruction of allocations vector
1 parent 179e8d5 commit 8ea6862

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎tray/include/core/windows/tray.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace Tray
2020
static HMENU construct(const std::vector<std::shared_ptr<TrayEntry>> &, Tray *parent, bool cleanup = false);
2121

2222
public:
23+
~Tray();
2324
Tray(std::string identifier, Icon icon);
2425
template <typename... T> Tray(std::string identifier, Icon icon, const T &...entries) : Tray(identifier, icon)
2526
{

‎tray/src/core/windows/tray.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ Tray::Tray::Tray(std::string identifier, Icon icon) : BaseTray(std::move(identif
5454
}
5555
trayList.insert({hwnd, *this});
5656
}
57-
57+
Tray::Tray::~Tray()
58+
{
59+
allocations.clear();
60+
}
5861
void Tray::Tray::exit()
5962
{
6063
Shell_NotifyIcon(NIM_DELETE, &notifyData);
@@ -63,10 +66,10 @@ void Tray::Tray::exit()
6366

6467
UnregisterClass(identifier.c_str(), GetModuleHandle(nullptr));
6568
PostMessage(hwnd, WM_QUIT, 0, 0);
66-
trayList.erase(hwnd);
6769
allocations.clear();
6870

6971
DestroyIcon(notifyData.hIcon);
72+
trayList.erase(hwnd);
7073
}
7174

7275
void Tray::Tray::update()

0 commit comments

Comments
 (0)
This repository has been archived.