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

Commit

Permalink
fix(windows): crash on destruction of allocations vector
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Jun 10, 2021
1 parent 179e8d5 commit 8ea6862
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions tray/include/core/windows/tray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Tray
static HMENU construct(const std::vector<std::shared_ptr<TrayEntry>> &, Tray *parent, bool cleanup = false);

public:
~Tray();
Tray(std::string identifier, Icon icon);
template <typename... T> Tray(std::string identifier, Icon icon, const T &...entries) : Tray(identifier, icon)
{
Expand Down
7 changes: 5 additions & 2 deletions tray/src/core/windows/tray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ Tray::Tray::Tray(std::string identifier, Icon icon) : BaseTray(std::move(identif
}
trayList.insert({hwnd, *this});
}

Tray::Tray::~Tray()
{
allocations.clear();
}
void Tray::Tray::exit()
{
Shell_NotifyIcon(NIM_DELETE, &notifyData);
Expand All @@ -63,10 +66,10 @@ void Tray::Tray::exit()

UnregisterClass(identifier.c_str(), GetModuleHandle(nullptr));
PostMessage(hwnd, WM_QUIT, 0, 0);
trayList.erase(hwnd);
allocations.clear();

DestroyIcon(notifyData.hIcon);
trayList.erase(hwnd);
}

void Tray::Tray::update()
Expand Down

0 comments on commit 8ea6862

Please sign in to comment.