on xenial help sign in
removed UnityMenuModelCache refing code.
113177bNick Dedekind
plugins/Unity/Indicators/qml/CachedUnityMenuModel.qml−6
@@ -43,12 +43,6 @@ Item {
43 return component;
43 return component;
44 }
44 }
45
45
46− Component.onCompleted: Indicators.UnityMenuModelCache.ref()
47− Component.onDestruction: {
48− model = null;
49− Indicators.UnityMenuModelCache.deref();
50− }
51−
52 Component {
46 Component {
53 id: modelComponent
47 id: modelComponent
54
48
plugins/Unity/Indicators/unitymenumodelcache.cpp+1−16
@@ -21,29 +21,14 @@
21#include <unitymenumodel.h>
21#include <unitymenumodel.h>
22
22
23UnityMenuModelCache::UnityMenuModelCache(QObject* parent)
23UnityMenuModelCache::UnityMenuModelCache(QObject* parent)
24− : QObject(parent),
24+ : QObject(parent)
25− m_ref(0)
26{
25{
27}
26}
28
27
29UnityMenuModelCache::~UnityMenuModelCache()
28UnityMenuModelCache::~UnityMenuModelCache()
30{
29{
31− qDeleteAll(m_menuModels);
32}
30}
33
31
34−void UnityMenuModelCache::ref()
35−{
36− m_ref++;
37−}
38−
39−void UnityMenuModelCache::deref()
40−{
41− --m_ref;
42− if (m_ref == 0) {
43− qDeleteAll(m_menuModels);
44− m_menuModels.clear();
45− }
46−}
47
32
48UnityMenuModel* UnityMenuModelCache::model(const QString& path) const
33UnityMenuModel* UnityMenuModelCache::model(const QString& path) const
49{
34{
plugins/Unity/Indicators/unitymenumodelcache.h−4
@@ -34,15 +34,11 @@ public:
34 UnityMenuModelCache(QObject*parent=NULL);
34 UnityMenuModelCache(QObject*parent=NULL);
35 ~UnityMenuModelCache();
35 ~UnityMenuModelCache();
36
36
37− Q_INVOKABLE void ref();
38− Q_INVOKABLE void deref();
39−
40 Q_INVOKABLE UnityMenuModel* model(const QString& path) const;
37 Q_INVOKABLE UnityMenuModel* model(const QString& path) const;
41 Q_INVOKABLE void registerModel(const QString& path, UnityMenuModel* menuModel);
38 Q_INVOKABLE void registerModel(const QString& path, UnityMenuModel* menuModel);
42
39
43private:
40private:
44 QHash<QString, UnityMenuModel*> m_menuModels;
41 QHash<QString, UnityMenuModel*> m_menuModels;
45− int m_ref;
46};
42};
47
43
48#endif // UNITYMENUMODELCACHE_H
44#endif // UNITYMENUMODELCACHE_H