Skip to content

Commit

Permalink
Fix potential leak and crash
Browse files Browse the repository at this point in the history
  • Loading branch information
hdlx committed Aug 30, 2024
1 parent fdd3be5 commit 9d95787
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/App.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,8 +1366,13 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
x += iconContainerSize;
}
BitBlt(ps.hdc, clientRect.left, clientRect.top, clientRect.right - clientRect.left, clientRect.bottom - clientRect.top, pGraphRes->_DC, 0, 0, SRCCOPY);

// Always restore old bitmap (see fn doc)
SelectObject(pGraphRes->_DC, oldBitmap);

GdipDeleteGraphics(pGraphics);
EndPaint(hwnd, &ps);

return 0;
}
case WM_ERASEBKGND:
Expand Down

0 comments on commit 9d95787

Please sign in to comment.