Fix crash in radiobutton destruction.

It crashed if the button was destroyed from group _changedCallback.
This commit is contained in:
John Preston
2018-12-05 13:55:56 +04:00
parent b10ccce44a
commit efe3dfad5c
13 changed files with 165 additions and 119 deletions
+7 -2
View File
@@ -66,12 +66,17 @@ void AbstractButton::mouseMoveEvent(QMouseEvent *e) {
void AbstractButton::mouseReleaseEvent(QMouseEvent *e) {
if (_state & StateFlag::Down) {
auto was = _state;
const auto was = _state;
_state &= ~State(StateFlag::Down);
auto weak = make_weak(this);
onStateChanged(was, StateChangeSource::ByPress);
if (!weak) {
return;
}
if (was & StateFlag::Over) {
_modifiers = e->modifiers();
auto weak = make_weak(this);
if (const auto callback = _clickedCallback) {
callback();
} else {