Skip to content

Commit

Permalink
Updated some dependencies & worked around a bug where existing instan…
Browse files Browse the repository at this point in the history
…ces would somehow persist
  • Loading branch information
Mrcubix committed Jul 16, 2023
1 parent 8cb340e commit 72264e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
26 changes: 18 additions & 8 deletions Wheel-Addon/WheelHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ public WheelHandler()
// start the RPC server
rpcServer = new RpcServer<WheelDaemon>("WheelDaemon");

rpcServer.Instance.OnSettingsChanged += (_, s) =>
{
this.settings = s;

Log.Debug(PLUGIN_NAME, "Settings updated");
};
rpcServer.Instance.OnSettingsChanged += OnSettingsChanged;

rpcServer.Instance.Initialize();

Expand Down Expand Up @@ -289,23 +284,38 @@ public static void HandlerLogSpacer(object? sender, string group)
OnLog?.Invoke(sender, new LogMessage(group, "----------------------------------------", LogLevel.Info));
}

#endregion

#region Other events

public void OnSettingsChanged(object? sender, Settings s)
{
this.settings = s;

Log.Debug(PLUGIN_NAME, "Settings updated");
}

#endregion

public void Dispose()
{
// unsubscribe from the events
OnLog -= OnLogSent;

OnWheelUsage -= OnWheelUsed;
OnWheelAction -= HandleSimpleModeAction;
OnWheelFingerUp -= HandleAdvancedMode;

// dispose of the settings
settings = null!;

rpcServer.Instance.OnSettingsChanged -= OnSettingsChanged;

// dispose of the rpc server
rpcServer?.Dispose();
rpcServer = null!;
}

#endregion

public FilterStage FilterStage => FilterStage.PreTranspose;

[BooleanProperty("Toggle Mode", ""),
Expand Down

0 comments on commit 72264e8

Please sign in to comment.