summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidassetsfileenginehandler.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-03-12 12:48:19 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-15 10:45:36 +0100
commit287fa94fe2f93e2857a4c15f69435c4ea14de82e (patch)
tree2ff53f815d8f58e89afc6d39ccc31e6a9da463fb /src/plugins/platforms/android/qandroidassetsfileenginehandler.h
parentde5185472651a6051a3c7b6e2519cc5f2b951a62 (diff)
Android: Fix another "QApplication not on main() thread" crash
The assets file engine is created before main() is called, thus prepopulate was called before main(). In this function, we created a QDataStream which internally created a QBuffer which inherits from QObject. This caused the main thread pointer to be initialized early, and the old "QApplication is not on the main() thread" warning and crash returned. The fix is to prepopulate the first time the file engine is used instead. Task-number: QTBUG-37444 Change-Id: I2c6e5f1a8ca88b5dc7d8e145fffeb7587dc0e623 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/qandroidassetsfileenginehandler.h')
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.h b/src/plugins/platforms/android/qandroidassetsfileenginehandler.h
index d56367d4d8..ac16ad7b79 100644
--- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.h
+++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.h
@@ -58,12 +58,13 @@ public:
QAbstractFileEngine *create(const QString &fileName) const;
private:
- void prepopulateCache();
+ void prepopulateCache() const;
AAssetManager *m_assetManager;
mutable QCache<QByteArray, QSharedPointer<AndroidAssetDir>> m_assetsCache;
mutable QMutex m_assetsCacheMutext;
- bool m_hasPrepopulatedCache;
+ mutable bool m_hasPrepopulatedCache;
+ mutable bool m_hasTriedPrepopulatingCache;
};
#endif // QANDROIDASSETSFILEENGINEHANDLER_H