View Issue Details

IDProjectCategoryView StatusLast Update
0001495NoesisGUIC++ SDKpublic2019-06-26 20:51
ReporternikobarliAssigned Tosfernandez 
Status resolvedResolutionfixed 
Product Version2.2.3 
Target Version2.2.4Fixed in Version2.2.4 
Summary0001495: VM instance bound to a UI element is not destroyed even after the bind target is nulled.
DescriptionFollow up from

So we have a code like this

            <ContentControl Content="{Binding CurrentItem}" />

class ItemVM : public BaseComponent, public INotifyPropertyChanged

class BindingCollectionVM : public BaseComponent, public INotifyPropertyChanged
    Ptr<ItemVM> m_item = MakePtr<ItemVM>(); // create ItemVM here

    void ButtonCmd() {
        m_item.Reset(); // Clear the item when a button is clicked
        _propertyChanged(this, NSS(CurrentItem));

    NS_IMPLEMENT_INLINE_REFLECTION(BindingCollectionVM, BaseComponent)
        NsProp("CurrentItem", &BindingCollectionVM::m_item );
We expect that when the ButtonCmd is fired, m_item is reset, then the ItemVM instance we created will be destroyed. However, it seems that the FrameworkElement still hold the reference preventing the destruction.

(as for the appearance, the ItemVM is correctly disappeared from the UI after the reset)

If for example, we create another instance of ItemVM and assign it to m_item, then the previous instance is correctly destroyed.

    void ButtonCmd() {
        m_item = MakePtr<ItemVM>();
        _propertyChanged(this, NSS(CurrentItem));
TagsNo tags attached.


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2019-06-18 07:44 nikobarli New Issue
2019-06-18 10:01 sfernandez Assigned To => sfernandez
2019-06-18 10:01 sfernandez Status new => assigned
2019-06-18 17:00 sfernandez Target Version => 2.2.4
2019-06-26 20:51 sfernandez Status assigned => resolved
2019-06-26 20:51 sfernandez Resolution open => fixed
2019-06-26 20:51 sfernandez Fixed in Version => 2.2.4