On Monday 15 August 2016, Dirk Hohndel wrote:
> > On Aug 15, 2016, at 7:50 AM, Marco Martin <notm...@gmail.com> wrote:
> > 
> > On Monday 15 August 2016, Dirk Hohndel wrote:
> >> Line numbers in kirigamiplugin.cpp are slightly off since I have a few
> >> lines of debug output in there; frame #9 is foreach (const QString
> >> &style, m_stylesFallbackChain) {
> >> frame #10 is
> >> 
> >>    qmlRegisterSingletonType(componentPath(QStringLiteral("Theme.qml")),
> >>    uri,
> >> 
> >> 1, 0, "Theme");
> >> 
> >> /D
> > 
> > as that list ended up to always be 2 at most, i may try to simplify that,
> > but if it's really a crash during a simple foreach of a string list,
> > suggests there may be something else..
> 
> Agreed. That's why I was saying it's an init issue.

just to get an idea, can you try the attached patch? if it works i would still 
have no idea why, but interesting never the less to see tyhe result


-- 
Marco Martin
diff --git a/src/kirigamiplugin.cpp b/src/kirigamiplugin.cpp
index fc530b3..546afa4 100644
--- a/src/kirigamiplugin.cpp
+++ b/src/kirigamiplugin.cpp
@@ -31,12 +31,11 @@ QString KirigamiPlugin::componentPath(const QString &fileName) const
     QString candidate;
     QString candidatePath;
 
-    foreach (const QString &style, m_stylesFallbackChain) {
-        candidate = QStringLiteral("styles/") + style + QLatin1Char('/') + fileName;
-        if (QFile::exists(resolveFilePath(candidate))) {
-            return resolveFileUrl(candidate);
-        }
+    candidate = QStringLiteral("styles/") + m_style + QLatin1Char('/') + fileName;
+    if (QFile::exists(resolveFilePath(candidate))) {
+        return resolveFileUrl(candidate);
     }
+
     return resolveFileUrl(fileName);
 }
 
@@ -52,12 +51,12 @@ void KirigamiPlugin::registerTypes(const char *uri)
 
 #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
     if (style.isEmpty() && QFile::exists(resolveFilePath(QStringLiteral("/styles/Desktop")))) {
-        m_stylesFallbackChain.prepend(QStringLiteral("Desktop"));
+        m_style = QStringLiteral("Desktop");
     }
 #endif
 
     if (!style.isEmpty() && QFile::exists(resolveFilePath(QStringLiteral("/styles/") + style))) {
-        m_stylesFallbackChain.prepend(style);
+        m_style = style;
     }
     //At this point the fallback chain will be selected->Desktop->Fallback
 
diff --git a/src/kirigamiplugin.h b/src/kirigamiplugin.h
index 92f73f2..de137fd 100644
--- a/src/kirigamiplugin.h
+++ b/src/kirigamiplugin.h
@@ -65,7 +65,7 @@ private:
         }
         return QStringLiteral("qrc:/") + filePath;
     }
-    QStringList m_stylesFallbackChain;
+    QString m_style;
 };
 
 #else
@@ -93,7 +93,7 @@ private:
     {
         return QStringLiteral("file://") + baseUrl().path() + QLatin1Char('/') + filePath;
     }
-    QStringList m_stylesFallbackChain;
+    QString m_style;
 };
 
 #endif

Reply via email to