Skip to content

Commit

Permalink
Fixed catastrophic bug that fragmented the heap, because I was access…
Browse files Browse the repository at this point in the history
…ing recently freed memory
  • Loading branch information
valinet committed Nov 14, 2021
1 parent a293c85 commit 4cd727a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SimpleWindowSwitcher/sws_WindowSwitcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ static sws_window _sws_WindowSwitcher_WindowList_PushToFront(sws_WindowSwitcher*
sws_window zero;
ZeroMemory(&zero, sizeof(sws_window));
sws_vector_PushBack(&(_this->pHWNDList), &zero);
// Reaquire list as vector may have been reallocated
pHWNDList = _this->pHWNDList.pList;
for (int i = _this->pHWNDList.cbSize - 1; i > 0; i--)
{
pHWNDList[i] = pHWNDList[i - 1];
Expand Down

0 comments on commit 4cd727a

Please sign in to comment.