Skip to content

Commit

Permalink
fix(Startup): Fix possible startup crash
Browse files Browse the repository at this point in the history
Fixes SOUNDSWITCH-1P6
Fixes #1341
  • Loading branch information
Belphemur committed Dec 23, 2023
1 parent 69dd5c1 commit f841977
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 3 additions & 1 deletion SoundSwitch/Model/SoundSwitchApplicationContext.cs
Expand Up @@ -5,6 +5,7 @@
using SoundSwitch.Framework.Audio.Lister;
using SoundSwitch.Framework.Banner;
using SoundSwitch.Framework.Configuration;
using SoundSwitch.Framework.NotificationManager;
using SoundSwitch.Framework.Profile;
using SoundSwitch.Framework.Updater;
using SoundSwitch.UI.Menu;
Expand All @@ -21,9 +22,10 @@ public SoundSwitchApplicationContext()

var deviceActiveLister = new CachedAudioDeviceLister(DeviceState.Active | DeviceState.Unplugged);
deviceActiveLister.Refresh();
MMNotificationClient.Instance.Register();

AppModel.Instance.InitializeMain(deviceActiveLister);

AppModel.Instance.NewVersionReleased += (sender, @event) =>
{
if (@event.UpdateMode == UpdateMode.Silent)
Expand Down
28 changes: 13 additions & 15 deletions SoundSwitch/Program.cs
@@ -1,17 +1,17 @@
/********************************************************************
* Copyright (C) 2015 Jeroen Pelgrims
* Copyright (C) 2015-2017 Antoine Aflalo
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
********************************************************************/
* Copyright (C) 2015 Jeroen Pelgrims
* Copyright (C) 2015-2017 Antoine Aflalo
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
********************************************************************/

using System;
using System.Diagnostics;
Expand Down Expand Up @@ -140,8 +140,6 @@ private static void Main()
try
{
#endif
MMNotificationClient.Instance.Register();

_synchronizationContext = new WindowsFormsSynchronizationContext();
SynchronizationContext.SetSynchronizationContext(_synchronizationContext);

Expand Down

0 comments on commit f841977

Please sign in to comment.