Skip to content

Commit

Permalink
"Fixed" trouble with cursor that "already in use somewhere"
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny 'Riketta' Chugaev committed Sep 4, 2018
1 parent 1cea2ed commit bee1c56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Warcraft Fishman/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,15 @@ public void FishingLoop()
action.Invoke(handle);

logger.Info("Starting fishing");
while (!Fishing(preset.GetActions(Action.Event.Fish)[0]))
logger.Warn("Starting fishing again");
try
{
while (!Fishing(preset.GetActions(Action.Event.Fish)[0]))
logger.Warn("Starting fishing again");
}
catch (Exception ex)
{
logger.Error("Exception occured while fishing: " + ex.ToString());
}

logger.Info("Invoking post-fishing actions");
foreach (var action in preset.GetActions(Action.Event.PostFish))
Expand Down
2 changes: 1 addition & 1 deletion Warcraft Fishman/DeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static Bitmap GetCurrentIcon()
{
using (Graphics g = Graphics.FromImage(icon))
WinApi.DrawIcon(g.GetHdc(), 0, 0, pci.hCursor);
cursorIcon = new Bitmap(icon); // We have to "clone" icon because handle won't be released if we continue use it
cursorIcon = new Bitmap(icon).Clone() as Bitmap; // We have to "clone" icon because handle won't be released if we continue use it
}
}

Expand Down

0 comments on commit bee1c56

Please sign in to comment.