Completed
Last Updated: 26 Aug 2014 10:26 by ADMIN
ADMIN
George
Created on: 07 Aug 2014 11:39
Category: Dock
Type: Bug Report
0
FIX. RadDock - Memory leak when adding and removing RadDock multiple times
To reproduce:

Add a RadDock to a form and every few seconds remove it and add a new one. You will see that the memory will increase. Apparently RadDock has subscribed to the Resize event of the parent form but does not unsubscribe when disposed.

Workaround:

Unsubscribe from the Resize event of the form prior disposing RadDock:

var ctrl = this.Controls["editor"];
var eventInfo = this.GetType().GetEvent("Resize");
var handlerMethod = typeof(RadDock).GetMethod("parentForm_Resize", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
var eventDelegate = Delegate.CreateDelegate(eventInfo.EventHandlerType, ctrl.Controls["radDock1"], handlerMethod);
eventInfo.RemoveEventHandler(this, eventDelegate);
this.Controls.Remove(ctrl);
ctrl.Dispose();
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments