From c2f7a9a0d4c8c58d117220893a0ee0b965187f4c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 28 Apr 2009 15:20:42 +1000 Subject: Don't create two atttached property objects per item. --- src/declarative/fx/qfxgridview.cpp | 7 +++++-- src/declarative/fx/qfxlistview.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 25c1565..b2fb1a1 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -79,8 +79,11 @@ public: } static QFxGridViewAttached *properties(QObject *obj) { - QFxGridViewAttached *rv = new QFxGridViewAttached(obj); - attachedProperties.insert(obj, rv); + QFxGridViewAttached *rv = attachedProperties.value(obj); + if(!rv) { + rv = new QFxGridViewAttached(obj); + attachedProperties.insert(obj, rv); + } return rv; } diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index c85d8ce..76f7e11 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -98,8 +98,11 @@ public: } static QFxListViewAttached *properties(QObject *obj) { - QFxListViewAttached *rv = new QFxListViewAttached(obj); - attachedProperties.insert(obj, rv); + QFxListViewAttached *rv = attachedProperties.value(obj); + if (!rv) { + rv = new QFxListViewAttached(obj); + attachedProperties.insert(obj, rv); + } return rv; } -- cgit v0.12