Project

General

Profile

Actions

Bug #6657

open

Cannot destroy WPopupWidget when it's hidden without invoking undefined behaviour

Added by Ján Dugáček about 6 years ago. Updated almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
10/08/2018
Due date:
% Done:

0%

Estimated time:
0:06 h

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.

Actions #1

Updated by Roel Standaert almost 6 years ago

  • Target version changed from 4.0.5 to 4.1.0
Actions

Also available in: Atom PDF