View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002915 | NoesisGUI | C++ SDK | public | 2023-12-04 13:01 | 2024-03-27 12:33 |
| Reporter | anton.sodergren_pdx | Assigned To | sfernandez | ||
| Priority | normal | Severity | major | ||
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.2.2 | ||||
| Target Version | 3.2.4 | Fixed in Version | 3.2.4 | ||
| Summary | 0002915: Unloaded event not invoked for inlines added through code | ||||
| Description | When a view is closed/destroyed, it is expected that the Unloaded event is called for all child elements of the view. However, this event is not called for Inline elements inside of a TextBlock, which can result in some cleanup code not being executed. Specifically, the event is not called on the inlines if they were added through code, but the event seems to be called as expected if the inlines were added in XAML. The inlines were added to the TextBlock in this manner: Noesis::InlineCollection& Inlines = *GetInlines(); | ||||
| Steps To Reproduce | These are not the exact steps for reproduction that we used, but this should reproduce the issue:
| ||||
| Platform | Any | ||||
|
When you say "invoke some code that closes the view" you mean destroying the IView, or just taking the TextBlock out of the UI tree? <UserControl x:Class="Testing.TestInlines" And this code-behind: struct TestInlines: public UserControl Could you reproduce it for example in the Hello World sample included in our SDK? |
|
|
Just destroying the UI element and thus taking it out of the UI tree, not destroying the top-level IView. I'll see if I can do a repro you can easily test. |
|
|
I do agree that your provided code should repro the issue based on my conclusions and what I wrote in the ticket, so I'll have to take a closer look at this. |
|
|
Did you find a way to reproduce this behavior? |
|
|
Hi, sorry that it took so long for me to get back to you. I have now managed to reproduce the issue in a more isolated manner. Try this code and see if it reproduces it for you: // .h // .cpp void TestInlines::OnRegisterUnloadedEventsChanged( Noesis::DependencyObject pSender, const Noesis::DependencyPropertyChangedEventArgs& EventArgs )
} NS_IMPLEMENT_REFLECTION( CFleetOrderControl, "Testing.TestInlines" ) The dependency property is not the main issue here, I just added it for testing purposes. This XAML works fine: <UserControl x:Class="Testing.TestInlines" While this does not. So something seems to go wrong when the text block is inside of a control template. It doesn't have to be the direct child of the control template, but it seems like it needs to be directly in the control template's scope, and not eg. be wrapper in a user control that is inside of the control template. |
|
|
Hello, just wanted to check, has there been another attempt at reproducing this issue? |
|
|
Here is a patch that fixes the issue with inlines not being Loaded/Unloaded when created inside a template (the changes are on TextBlock::OnPostInit() method).
|
|
|
Thank you, I will try this out today! We are not building Noesis from source in our usual build setup, but I think I can apply the patch and build Noesis locally. |
|
|
Nice, it does appear to fix this issue indeed, thanks! :) I'm supposing this will also get into Noesis 3.2.4? We also have some different issues related to inlines, I was hoping that this fix would fix that too, but it seems that's not the case unfortunately. We're getting a heap corruption when calling Clear() on a Noesis::InlineCollection in some cases (it's related to bindings that we are doing in those inlines). But we'll continue investigating that a bit separately and see if that is also a Noesis bug or if we're doing something wrong with it. |
|
|
Yes, this will be included in the next 3.2.4 version. Please open a new ticket regarding the heap corruption deleting inlines if you find it is a Noesis issue, thanks! |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2023-12-04 13:01 | anton.sodergren_pdx | New Issue | |
| 2023-12-04 13:01 | anton.sodergren_pdx | Tag Attached: C++ | |
| 2023-12-05 10:16 | jsantos | Target Version | => 3.2.3 |
| 2023-12-05 10:16 | jsantos | Assigned To | => sfernandez |
| 2023-12-05 10:16 | jsantos | Status | new => assigned |
| 2023-12-05 11:26 | sfernandez | Status | assigned => feedback |
| 2023-12-05 11:26 | sfernandez | Note Added: 0009001 | |
| 2023-12-05 11:26 | sfernandez | Note Edited: 0009001 | |
| 2023-12-08 13:49 | anton.sodergren_pdx | Note Added: 0009004 | |
| 2023-12-08 13:49 | anton.sodergren_pdx | Status | feedback => assigned |
| 2023-12-08 13:51 | anton.sodergren_pdx | Note Added: 0009005 | |
| 2024-01-22 11:47 | sfernandez | Target Version | 3.2.3 => 3.2.4 |
| 2024-01-22 12:07 | sfernandez | Status | assigned => feedback |
| 2024-01-22 12:07 | sfernandez | Note Added: 0009098 | |
| 2024-02-20 17:27 | anton.sodergren_pdx | Note Added: 0009224 | |
| 2024-02-20 17:27 | anton.sodergren_pdx | Status | feedback => assigned |
| 2024-02-20 17:28 | anton.sodergren_pdx | Note Edited: 0009224 | |
| 2024-03-07 16:23 | anton.sodergren_pdx | Note Added: 0009292 | |
| 2024-03-08 17:28 | sfernandez | Note Added: 0009305 | |
| 2024-03-08 17:29 | sfernandez | Status | assigned => feedback |
| 2024-03-11 12:53 | anton.sodergren_pdx | Note Added: 0009311 | |
| 2024-03-11 12:53 | anton.sodergren_pdx | Status | feedback => assigned |
| 2024-03-11 14:18 | anton.sodergren_pdx | Note Added: 0009313 | |
| 2024-03-27 12:31 | sfernandez | Status | assigned => resolved |
| 2024-03-27 12:31 | sfernandez | Resolution | open => fixed |
| 2024-03-27 12:31 | sfernandez | Fixed in Version | => 3.2.4 |
| 2024-03-27 12:33 | sfernandez | Note Added: 0009351 |