- realesmedia
- Posts: 85
- Joined:
[C++] Clear resources on collection item remove.
I have my own component placed in observable collection with binding to treeview.
Component have ref-counter. When I put new element to collection it have ref counter equal 15. When I remove item from collection with Remove() method ref-counter have the same value. When I select another item in collection (by clicking on treeview) ref-counter drops to 1.
How can I clear resources in place where item was removed?
Component have ref-counter. When I put new element to collection it have ref counter equal 15. When I remove item from collection with Remove() method ref-counter have the same value. When I select another item in collection (by clicking on treeview) ref-counter drops to 1.
How can I clear resources in place where item was removed?
Last edited by realesmedia on 23 Mar 2018, 12:25, edited 2 times in total.
-
sfernandez
Site Admin
- Posts: 3003
- Joined:
Re: [C++] Clear resources on collection item remove.
Sorry for the late answer.
Is it possible that the item you are removing is currently selected in the TreeView?
Our code seems to clean the references to the TreeView.SelectedItem property, but maybe we have something wrong I'm not seeing now.
Could you please report it in our bugtracker attaching the sample code and we will take a look?
Thanks for your collaboration.
Is it possible that the item you are removing is currently selected in the TreeView?
Our code seems to clean the references to the TreeView.SelectedItem property, but maybe we have something wrong I'm not seeing now.
Could you please report it in our bugtracker attaching the sample code and we will take a look?
Thanks for your collaboration.
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Clear resources on collection item remove.
If element had been removed when it's selected, refcounter greater 1, but must be 1.
Otherwise when not selected refcounter correctly equal 1.
Otherwise when not selected refcounter correctly equal 1.
-
sfernandez
Site Admin
- Posts: 3003
- Joined:
Re: [C++] Clear resources on collection item remove.
Thanks, that helps trying to narrow where the problem comes from.
As soon as we fix it I let you know.
As soon as we fix it I let you know.
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Clear resources on collection item remove.
UPD: Clearing collection with Clear() method have the same effect as in case of removing single item.
-
sfernandez
Site Admin
- Posts: 3003
- Joined:
Re: [C++] Clear resources on collection item remove.
We found the source of the problem and fix it.
It would be solve in the next beta release we generate, probably tonight.
It would be solve in the next beta release we generate, probably tonight.
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Clear resources on collection item remove.
Additional problem.
Have few tabs. First tab have collection with selected item.
Case 1: First tab selected. Close app and have item's destructor call.
Case 2: Second tab selected (first doesn't visible). Close app and have NO destructor call for selected item in collection.
Have few tabs. First tab have collection with selected item.
Case 1: First tab selected. Close app and have item's destructor call.
Case 2: Second tab selected (first doesn't visible). Close app and have NO destructor call for selected item in collection.
-
sfernandez
Site Admin
- Posts: 3003
- Joined:
Re: [C++] Clear resources on collection item remove.
Do you mean an items control with a collection attached inside each tab, and then item destructors are only called when closing with first tab selected?
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Clear resources on collection item remove.
Sources in attachment which reproduce bug.
Two tabs have binding to different collections.
Each tab have 5 items.
Normal case:
Click button and see that all destructors ~MyComponent() called.
Bug case:
Select an item and click button. Destructor for selected item didn't call. Closing app call destructor.
I cannot reproduce bug with case when destructor not callable after closing the app.
Two tabs have binding to different collections.
Each tab have 5 items.
Normal case:
Click button and see that all destructors ~MyComponent() called.
Bug case:
Select an item and click button. Destructor for selected item didn't call. Closing app call destructor.
I cannot reproduce bug with case when destructor not callable after closing the app.
- Attachments
-
- Src.zip
- Sample with bug reproduction
- (1.75 KiB) Downloaded 154 times
-
sfernandez
Site Admin
- Posts: 3003
- Joined:
Re: [C++] Clear resources on collection item remove.
Thanks for the sample project, I'll take a look as soon as possible and let you know.
Who is online
Users browsing this forum: Google [Bot] and 5 guests