[vlc-commits] Qt(menu): fix skins2 issues with checkbox menus
Erwan Tulou
git at videolan.org
Fri Nov 29 14:33:58 CET 2019
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Nov 28 21:01:19 2019 +0100| [1a2932b4b0c9ce100d0dffdf895f4f245a57ff49] | committer: Erwan Tulou
Qt(menu): fix skins2 issues with checkbox menus
The bug:
- launch a video with vlc(skins2).
- Press 'o' to toggle autoscale.
- click outside vlc to lose the focus.
- click again on vlc and press again on 'o'.
At this point, the Qt thread no longer responds because of a deadlock
The cause is an undue connect (on toggled signal) that sets again the variable
while it was already being set in a callback (via hotkey).
The patch does the following:
- removes the undue connect (on toggled signal)
- ensure the essential connect (on triggered signal) is always called
- add a proper initialisation that was missing
- assert instead of if (the degraded mode is never used)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a2932b4b0c9ce100d0dffdf895f4f245a57ff49
---
modules/gui/qt/components/custom_menus.cpp | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/modules/gui/qt/components/custom_menus.cpp b/modules/gui/qt/components/custom_menus.cpp
index e11ba4f231..099ff06572 100644
--- a/modules/gui/qt/components/custom_menus.cpp
+++ b/modules/gui/qt/components/custom_menus.cpp
@@ -297,18 +297,14 @@ BooleanPropertyAction::BooleanPropertyAction(QString title, QObject *model, QStr
QMetaProperty property = meta->property(propertyId);
assert(property.type() == QVariant::Bool);
const QMetaObject* selfMeta = this->metaObject();
- if (property.hasNotifySignal())
- {
- QMetaMethod checkedSlot = selfMeta->method(selfMeta->indexOfSlot( "setChecked(bool)" ));
- connect( model, property.notifySignal(), this, checkedSlot );
- connect( this, &BooleanPropertyAction::toggled, this, &BooleanPropertyAction::setModelChecked );
- setCheckable(true);
- }
- else
- {
- connect( this, &BooleanPropertyAction::triggered, this, &BooleanPropertyAction::setModelChecked );
- setCheckable(true);
- }
+
+ assert(property.hasNotifySignal());
+ QMetaMethod checkedSlot = selfMeta->method(selfMeta->indexOfSlot( "setChecked(bool)" ));
+ connect( model, property.notifySignal(), this, checkedSlot );
+ connect( this, &BooleanPropertyAction::triggered, this, &BooleanPropertyAction::setModelChecked );
+
+ setCheckable(true);
+ setChecked(property.read(model).toBool());
}
void BooleanPropertyAction::setModelChecked(bool checked)
More information about the vlc-commits
mailing list