Bug #6657
openCannot destroy WPopupWidget when it's hidden without invoking undefined behaviour
0%
Description
The documentation suggests to empty a unique_ptr
holding the WPopupWidget
when it's hidden to destroy the WPopupWidget
(https://webtoolkit.eu/wt/doc/reference/html/classWt_1_1WPopupWidget.html). However, when I try it, I get undefined behaviour. I managed to pinpoint the problem.
WPopupWidget::setHidden
(https://github.com/emweb/wt/blob/master/src/Wt/WPopupWidget.C#L73) first emits the hidden signal and calls some non-static methods. However, emitting the signal may cause the object to be destroyed and thus the non-static methods use the already destroyed object. If I move the signal-emitting part to the end of the method (as it is in WDialog's methods), no undefined behaviour occurs. However, I don't know if this solution doesn't break something I am not using.
Updated by Roel Standaert about 6 years ago
- Target version changed from 4.0.5 to 4.1.0