Custom editor property grid memory leak

Hi,

 

                I’m using Syncfusion custom editor to bind to the property grid. Please find the code below,

 

Code snippet:

 

public class eFormColorEditor : ITypeEditor

    {

        private ColorPickerSelector brushSelector;

        #region ITypeEditor Members

 

        public void Attach(PropertyViewItem property, PropertyItem info)

        {

            if (info.CanWrite)

            {

                var binding = new Binding("Value")

                {

                    Mode = BindingMode.TwoWay,

                    Source = info,

                    ValidatesOnExceptions = true,

                    ValidatesOnDataErrors = true,

                    Converter = new ColorToBrushTypeConverter()

                };

                BindingOperations.SetBinding(brushSelector, ColorPickerSelector.SelectedColorProperty, binding);

            }

            else

            {

                var binding = new Binding("Value")

                {

                    Mode = BindingMode.OneWay,

                    Source = info,

                    ValidatesOnExceptions = true,

                    ValidatesOnDataErrors = true,

                    Converter = new ColorToBrushTypeConverter()

                };

                BindingOperations.SetBinding(brushSelector, ColorPickerSelector.SelectedColorProperty, binding);

            }

 

        }       

 

        public object Create(System.Reflection.PropertyInfo PropertyInfo)

        {

            brushSelector = new ColorPickerSelector();

            return brushSelector;

        }       

 

        public void Detach(PropertyViewItem property)

        {           

        }

 

        #endregion

    }

 

    public class ColorToBrushTypeConverter : IValueConverter

    {

        #region IValueConverter Members

 

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

            if (value != null && value is SolidColorBrush)

            {

                return (value as SolidColorBrush).Color;

            }

            return value;

        }

 

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

            if (value != null)

            {

                return new SolidColorBrush((Color)value);

            }

            return value;

        }

 

        #endregion

    }

 

In ColorPickerSelector class, I have used a colorpickerpalette to select the color.

When I dispose the control, I notice that the ColorPickerSelector and  ColorToBrushTypeConverter object is retained in the memory.

I’m facing some memory leak issues due to this. I face this issue with other custom editors as well.

 

I would like to know if the object is retained in the memory, if so how do I release the object.

1 Reply

KL Karthikeyan L Syncfusion Team May 25, 2012 04:55 AM UTC

Hi Aishwaria,

Could you please follow up this query through the incident, which is logged in our Direct-trac support system, under the Incident id #94684.

Please let us know if you have any concern.

Regards,
Karthikeyan

Loader.
Up arrow icon