Skip to content

Commit

Permalink
memory leak error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnpascual committed Feb 24, 2021
1 parent 9f20033 commit 7dcefbf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Match3Solver/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref
new Thread(() =>
{
System.Drawing.Bitmap screenshot = debugMode ? new System.Drawing.Bitmap(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\debug.png") : captureBoard();
if(screenshot == null)
{
return;
}
board = solver.parseImage(screenshot);
screenshot.Dispose();
GC.Collect();
Expand Down

0 comments on commit 7dcefbf

Please sign in to comment.