Fix possible crash in checkbox.

This commit is contained in:
John Preston 2022-06-06 12:20:22 +04:00
parent 0a713c1c7b
commit 72940a25e3

View file

@ -707,6 +707,7 @@ void Checkbox::mouseMoveEvent(QMouseEvent *e) {
}
void Checkbox::mouseReleaseEvent(QMouseEvent *e) {
const auto weak = Ui::MakeWeak(this);
if (auto activated = _activatingHandler = ClickHandler::unpressed()) {
const auto button = e->button();
crl::on_main(this, [=] {
@ -715,7 +716,9 @@ void Checkbox::mouseReleaseEvent(QMouseEvent *e) {
});
}
RippleButton::mouseReleaseEvent(e);
_activatingHandler = nullptr;
if (weak) {
_activatingHandler = nullptr;
}
}
void Checkbox::leaveEventHook(QEvent *e) {