When the DefaultCloseRequest property of the KryptonDockingManager is set to RemovePageAndDispose, closing a floating window crashes the application.
Steps to reproduce: in the "Navigator + FloatingWindows 2019" example (from Krypton Docking examples), set the DockingAllowClose flag of the new pages to allow the user to close them, set the DefaultCloseRequest property of the KryptonDockingManager to RemovePageAndDispose, then run the project and close a floating window.
The same issue can occur when a floating window is disposing immediately at closing, even if a different DefaultCloseRequest is used.
This issue is caused by the ShadowManager.FlashWindowExListener class which does not expect the window to be possibly disposed before the Closing event is fired. It tries to access the Handle property of the window to remove it from its internal list of forms, however that property cannot be accessed after the window has been disposed and that causes a crash.
The fix is to adapt its Closing event handler to use the window's handle directly (stored in a closure) rather than a reference to the window.
Hello,
When the
DefaultCloseRequest
property of theKryptonDockingManager
is set toRemovePageAndDispose
, closing a floating window crashes the application.Steps to reproduce: in the "Navigator + FloatingWindows 2019" example (from Krypton Docking examples), set the
DockingAllowClose
flag of the new pages to allow the user to close them, set theDefaultCloseRequest
property of theKryptonDockingManager
toRemovePageAndDispose
, then run the project and close a floating window.The same issue can occur when a floating window is disposing immediately at closing, even if a different
DefaultCloseRequest
is used.This issue is caused by the
ShadowManager.FlashWindowExListener
class which does not expect the window to be possibly disposed before theClosing
event is fired. It tries to access theHandle
property of the window to remove it from its internal list of forms, however that property cannot be accessed after the window has been disposed and that causes a crash.The fix is to adapt its
Closing
event handler to use the window's handle directly (stored in a closure) rather than a reference to the window.