From d94b9caba5531500c9e716702db535211c339cff Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 3 Sep 2020 16:11:35 +0200 Subject: [PATCH] [libcalamaresui] Less mutex shenanigans --- src/libcalamaresui/viewpages/Slideshow.cpp | 14 +++++++++----- src/libcalamaresui/viewpages/Slideshow.h | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/libcalamaresui/viewpages/Slideshow.cpp b/src/libcalamaresui/viewpages/Slideshow.cpp index 13f0a3e51..268843421 100644 --- a/src/libcalamaresui/viewpages/Slideshow.cpp +++ b/src/libcalamaresui/viewpages/Slideshow.cpp @@ -117,11 +117,8 @@ SlideshowQML::loadQmlV2Complete() { // We're alreay visible! Must have been slow QML loading, and we // passed onActivate already. changeSlideShowState() locks - // the same mutex: we could set up a workaround to call - // changeSlideShowState() later after destruction of l. - // - l.unlock(); - changeSlideShowState( Slideshow::Start ); + // the same mutex: call changeSlideShowState() after l is dead. + QTimer::singleShot( 0, this, &SlideshowQML::startSlideShow ); } } } @@ -142,6 +139,13 @@ SlideshowQML::loadQmlV2Complete() } } +void +SlideshowQML::startSlideShow() +{ + changeSlideShowState( Slideshow::Start ); +} + + /* * Applies V1 and V2 QML activation / deactivation: * - V1 loads the QML in @p widget on activation. Sets root object property diff --git a/src/libcalamaresui/viewpages/Slideshow.h b/src/libcalamaresui/viewpages/Slideshow.h index 732734755..4432eed7b 100644 --- a/src/libcalamaresui/viewpages/Slideshow.h +++ b/src/libcalamaresui/viewpages/Slideshow.h @@ -100,6 +100,9 @@ public slots: void loadQmlV2Complete(); void loadQmlV2(); ///< Loads the slideshow QML (from branding) for API version 2 + /// Implementation detail + void startSlideShow(); + private: QQuickWidget* m_qmlShow; QQmlComponent* m_qmlComponent;