In the widgets sample, when using the UI to modify the style of a widget, the current widget(s) is/are destroyed and then recreated.
On pages where there is more than one widget being shown (e.g., on the static text page), this can lead to the sample crashing or freezing. The reason is still the same as in #24487 (i.e., a8b4753):
WidgetsPage::NotifyWidgetRecreation()
update function is called for the widget; however, this ends in WidgetsPage::SetUpWidget()
where the whole page widgets collection is iterated and the stale pointers to the destroyed widgets accessed.I am not sure how to best fix it at the sample level, instead of fixing each page, so for now I am just posting an Issue, not a PR. Perhaps using wxWeakRef
instead of raw pointers in the widget collection would be a simple fix? But the current way, i.e., setting-up all the widgets each time one of them is (re)created, seems not ideal so a whole different approach may be better...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
After looking at a8b4753, it became clear that only two pages (static and spin) were affected by this bug (i.e., call NotifyWidgetRecreation()
more than once when recreating widgets), so I opted for the simplest solution possible.
I think have encountered a freeze in some other page(s?) of the sample but the reason must be different, I don't remember which page it was, so I am closing this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #24656 as completed via 19ec50b.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.