Skip to content

Commit

Permalink
Fix #53, application crashes when exiting from system tray while
Browse files Browse the repository at this point in the history
also listening for voice input.

Thanks cr0ss0vr.
  • Loading branch information
Robert Baykov committed Aug 27, 2016
1 parent 74029a7 commit 9d4f2f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions GAVPI/GAVPI/Core/GAVPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,13 @@ static private void Exit( object SelectedMenuItem, EventArgs e )

Properties.Settings.Default.Save();

// Stop listening.
StopListening(null, null);

// And get rid of the system tray icon.
if (sysTrayIcon != null)
{
// strackoverflow tip:
// trayicon must be set to null in order to keep it from lingering in the tray.
// Robert (04.23.15)
// Tray icon must be set to null in order to keep it from lingering in the tray.
sysTrayIcon.Visible = false;
sysTrayIcon.Dispose();
sysTrayIcon = null;
Expand Down
2 changes: 1 addition & 1 deletion GAVPI/GAVPI/GUI/frmGAVPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void frmGAVPI_Activated( object sender, System.EventArgs e )

private void frmGAVPI_FormClosing( object sender, FormClosingEventArgs e )
{
if (GAVPI.IsFirstClose)
if (GAVPI.IsFirstClose && GAVPI.sysTrayIcon != null)
{
GAVPI.sysTrayIcon.BalloonTipTitle = "GAVPI is still running.";
GAVPI.sysTrayIcon.BalloonTipText =
Expand Down

0 comments on commit 9d4f2f1

Please sign in to comment.