Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

[BUG] ObjectDisposedException on ButtonSpecMdiChildMin #242

Closed
tbolon opened this issue Dec 3, 2019 · 0 comments · Fixed by #243
Closed

[BUG] ObjectDisposedException on ButtonSpecMdiChildMin #242

tbolon opened this issue Dec 3, 2019 · 0 comments · Fixed by #243
Labels

Comments

@tbolon
Copy link
Contributor

tbolon commented Dec 3, 2019

We often capture errors from our application where the ButtonSpecMdiChildMin controls try to access the MdiChild property when the handle is destroyed/destroying.

System.ObjectDisposedException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source	System.Windows.Forms
StackTrace	   à System.Windows.Forms.Control.CreateHandle()
   à System.Windows.Forms.Form.CreateHandle()
   à System.Windows.Forms.Control.get_Handle()
   à ComponentFactory.Krypton.Toolkit.CommonHelper.IsFormMaximized(Form f)
   à ComponentFactory.Krypton.Ribbon.ButtonSpecMdiChildMin.GetVisible(IPalette palette)
   à ComponentFactory.Krypton.Toolkit.ButtonSpecView.UpdateVisible()
   à ComponentFactory.Krypton.Toolkit.ButtonSpecView..ctor(PaletteRedirect redirector, IPaletteMetric paletteMetric, PaletteMetricPadding metricPadding, ButtonSpecManagerBase manager, ButtonSpec buttonSpec)
   à ComponentFactory.Krypton.Ribbon.ButtonSpecManagerLayoutRibbon.CreateButtonSpecView(PaletteRedirect redirector, IPaletteMetric viewPaletteMetric, PaletteMetricPadding viewMetricPadding, ButtonSpec buttonSpec)
   à ComponentFactory.Krypton.Toolkit.ButtonSpecManagerBase.AddButtonSpec(ButtonSpec buttonSpec)
   à ComponentFactory.Krypton.Toolkit.ButtonSpecManagerBase.CreateFromCollection(ButtonSpecCollectionBase specs, Int32[]& nearCounts, Int32[]& farCounts)
   à ComponentFactory.Krypton.Toolkit.ButtonSpecManagerBase.CreateAll()
   à ComponentFactory.Krypton.Ribbon.KryptonRibbon.UpdateBackStyle()
   à ComponentFactory.Krypton.Ribbon.ViewLayoutRibbonTabsArea.OnRibbonFormDeactivate(Object sender, EventArgs e)
   à System.Windows.Forms.Form.OnDeactivate(EventArgs e)
   à ComponentFactory.Krypton.Toolkit.VisualForm.OnDeactivate(EventArgs e)
   à System.Windows.Forms.Form.set_Active(Boolean value)
   à System.Windows.Forms.Form.WmActivate(Message& m)
   à System.Windows.Forms.Form.WndProc(Message& m)
   à ComponentFactory.Krypton.Toolkit.VisualForm.WndProc(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The method GetVisible from ButtonSpecMdiChildMin should check IsHandleCreated / IsDisposed before calling a method which will use the Handle property.

@tbolon tbolon added the bug label Dec 3, 2019
tbolon added a commit to mb3m/Krypton-NET-5.470 that referenced this issue Dec 3, 2019
PWagner1 added a commit that referenced this issue Dec 3, 2019
fix access Disposed mdi child form #242
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant