Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/27/10 16:43:33 (14 years ago)
Author:
mkommend
Message:

Deregistered content events before a view is disposed in the ViewHost (ticket #1211).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.cs

    r4511 r4521  
    5757            }
    5858          }
     59
    5960          activeView = value;
     61
    6062          if (activeView != null) {
    61             View cached = cachedView as View;
    62             if (cached != null && activeView != cached) {
    63               Controls.Remove(cached);
    64               cached.Dispose();
     63            #region disposed cachedView
     64            if (activeView != cachedView) {
     65              if (cachedView != null) cachedView.Content = null;  //needed to deregister events
     66              View cached = cachedView as View;
     67              if (cached != null) {
     68                Controls.Remove(cached);
     69                cached.Dispose();
     70              }
     71              cachedView = null;
    6572            }
    66             cachedView = null;
     73            #endregion
    6774
    6875            this.Caption = activeView.Caption;
Note: See TracChangeset for help on using the changeset viewer.