Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
UltraToolbarsManager handled by SystemEvents.UserPreferenceChangedEventHandler
posted

Hi,

 

I think that I have a little problem with the UltraToolbarsManager component. I use a lot an inherited version of the ToolbarsManager called UCToolbar in my program and it seems to be a source of memory leak.

When I  close a form containing an UCToolbar, the dispose() method of my toolbar is called but the memory seems not to be freed. I used Dot Trace and saw that my Toolbar was kept alive by a reference from SystemEvents.UserPreferenceChangedEventHandler. (See the picture for more details).

What can I do for removing this reference which kept alive all my form ?

 

Thanks for your help,

Regards

 

Here is the code of my inherited class :

public partial class UCToolbarsManager : UltraToolbarsManager, IUCEditor
  {

    public bool EditMode
    {
      get { return this.Visible; }
      set { this.Visible = value; }
    }

    public UCToolbarsManager(IContainer container)
      : base(container)
    {
      InitializeComponent();
    }
  }

 

 

 

  • 44743
    posted

    The UltraToolbarsManager must be disposed when the Form is closed. If you are calling the Dispose method on it, put a breakpoint on the line and make sure it is actually getting called when the Form closes. If it is definitely getting called and the memory leak is still occurring, you can submit the issue to Developer Support here.

  • 405
    posted

    Hi lchambaret ,

    Having a similar problem to which you describe. tried several things but NO LUCK! i hope that adding this post will prioritize this issue, since it is causing us Memory leaks as well.

    my code part is: 

    public Control BeginPrepareToolbarArea(XElement definition, GenericSession creationContext)

    {

     

    var mgr = new UltraToolbarsManager();  

     var dockArea = new UltraToolbarsDockArea();

     

    var defaultOptionSet = new OptionSet("OptionSet")

    {AllowAllUp =

    false};

     

     

    var ultraToolbarsManagerAppearance = new Appearance();

    ((

     

    ISupportInitialize)(mgr)).BeginInit();

    dockArea.AccessibleRole =

    AccessibleRole.Grouping;

    dockArea.DockedPosition =

     

    DockedPosition.Top;

    dockArea.Location =

     

    new System.Drawing.Point(0, 0);

    dockArea.ToolbarsManager = mgr;

     

    ultraToolbarsManagerAppearance.FontData.Name = DefaultFontName;

    mgr.Appearance = ultraToolbarsManagerAppearance;

    mgr.DesignerFlags = 0;

    mgr.OptionSets.Add(defaultOptionSet);

    mgr.ShowFullMenusDelay = 500;

    mgr.ShowMenuShadows =

    DefaultableBoolean.False;

    mgr.ShowQuickCustomizeButton =

     

    false;

    mgr.UseOsThemes =

     

    DefaultableBoolean.False;

    mgr.ToolbarSettings.AllowFloating =

     

    DefaultableBoolean.False;

    mgr.RightAlignedMenus =

     

    DefaultableBoolean.False;

    mgr.RuntimeCustomizationOptions =

     

    RuntimeCustomizationOptions.None;

    creationContext[

     

    "ToolbarsManager"] = mgr;

    creationContext[

     

    "ToolbarsDockArea"] = dockArea;

     

     

     

     

     

     

    return dockArea;