From 8e1491e94bd13b6df28a1a904a9f1f46cc8075ec Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sun, 1 Jan 2023 13:05:04 +0100 Subject: [PATCH] try to fix an exception on Mac * InvalidOperationException: This PlotModel is already in use by some other PlotView control --- Source/OxyPlot.Xamarin.Mac/PlotView.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/OxyPlot.Xamarin.Mac/PlotView.cs b/Source/OxyPlot.Xamarin.Mac/PlotView.cs index d25084f..f318e3a 100644 --- a/Source/OxyPlot.Xamarin.Mac/PlotView.cs +++ b/Source/OxyPlot.Xamarin.Mac/PlotView.cs @@ -74,6 +74,20 @@ private void Initialize() { this.WantsLayer = true; } + /// + /// Dispose the instance. + /// + /// Is the instance disposing. + protected override void Dispose(bool disposing) + { + if (disposing) + { + this.Model = null; + } + + base.Dispose(disposing); + } + /// /// Gets or sets the to show in the view. ///