This is a migrated thread and some comments may be shown as answers.

RadAutoCompleteBox Dispose

1 Answer 83 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Matthias Bibo
Top achievements
Rank 1
Matthias Bibo asked on 13 Jun 2014, 07:22 AM

Hi,

is there a reason why the Dispose funktion of the RadAutoCompleteBox is not declared as virtual? We have implemented our own derived  Class BDLAutoCompleteBox that has its own Dispose funktion and calls the base.Dispose funktion. We need this to extend the funktionality of the Class to our specific needs. We also have a workaround in the Dipose to clear a Memory leak:
public new void Dispose()
{
    this.GotFocus -= this.BdlAutoCompleteBoxGotFocus;
    this.SelectionChanged -= this.BdlAutoCompleteBoxSelectionChanged;
    this.MouseRightButtonDown -= this.BdlAutoCompleteBoxMouseRightButtonDown;
    this.MouseRightButtonUp -= this.BdlAutoCompleteBoxMouseRightButtonUp;
 
    if (!this.isDisposed)
    {
        try
        {
            // Fix, für Telerik memory leak (SizeChanged handler des textBoxPart, wird dadurch aber nicht ganz behoben)
            Type typeAutoCompleteBox = typeof(RadAutoCompleteBox);
            System.Reflection.FieldInfo field = typeAutoCompleteBox.GetField("textBoxPart", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
 
            if (field != null)
            {
                field.SetValue(this, null);
            }
        }
        catch (Exception)
        {
            //TG: Only Workaround for MemoryLeak, Exceptions should not be thrown in this case
        }
    }
 
    this.isDisposed = true;
 
    base.Dispose();
}

Best Regards
Matthias

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 16 Jun 2014, 11:11 AM
Hi Matthias,

Thank you for bringing this to our attention. We will do our best to improve the described Dispose implementation.

We noticed that the provided code snippet solves memory leak issue in the RadAutoCompleteBox control. The corresponding issues have been resolved on our side and there is not need to resolve them in your custom inherited class.

The mentioned fix should be available in our next official release of Telerik UI for Silverlight.

Regards,
Vladi
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
AutoCompleteBox
Asked by
Matthias Bibo
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or