diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-18 14:51:35 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-18 14:51:35 (GMT) |
commit | 396eeb3f71c1c7edd861da1c8a8ec3086348502e (patch) | |
tree | 3ff6670ef4b192fd0993e0e9629e616570a6475a /src/gui/itemviews | |
parent | e356eed2fa3d8e62085d6bd72caba9d11c40bacf (diff) | |
parent | 31ed96ef2c34429d61a5d9d1c1b7fe4fc17c708b (diff) | |
download | Qt-396eeb3f71c1c7edd861da1c8a8ec3086348502e.zip Qt-396eeb3f71c1c7edd861da1c8a8ec3086348502e.tar.gz Qt-396eeb3f71c1c7edd861da1c8a8ec3086348502e.tar.bz2 |
Merge branch '4.5' of scm.dev.nokia.troll.no:qt/qt
Conflicts:
configure.exe
tests/auto/qpainter/tst_qpainter.cpp
translations/qt_ru.ts
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qitemeditorfactory.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/itemviews/qitemeditorfactory.cpp b/src/gui/itemviews/qitemeditorfactory.cpp index c576e40..480a472 100644 --- a/src/gui/itemviews/qitemeditorfactory.cpp +++ b/src/gui/itemviews/qitemeditorfactory.cpp @@ -158,6 +158,10 @@ QByteArray QItemEditorFactory::valuePropertyName(QVariant::Type type) const */ QItemEditorFactory::~QItemEditorFactory() { + //we make sure we delete all the QItemEditorCreatorBase + //this has to be done only once, hence the QSet + QSet<QItemEditorCreatorBase*> set = creatorMap.values().toSet(); + qDeleteAll(set); } /*! @@ -170,8 +174,16 @@ QItemEditorFactory::~QItemEditorFactory() */ void QItemEditorFactory::registerEditor(QVariant::Type type, QItemEditorCreatorBase *creator) { - delete creatorMap.value(type, 0); - creatorMap[type] = creator; + QHash<QVariant::Type, QItemEditorCreatorBase *>::iterator it = creatorMap.find(type); + if (it != creatorMap.end()) { + QItemEditorCreatorBase *oldCreator = it.value(); + Q_ASSERT(oldCreator); + creatorMap.erase(it); + if (!creatorMap.values().contains(oldCreator)) + delete oldCreator; // if it is no more in use we can delete it + } + + creatorMap[type] = creator; } class QDefaultItemEditorFactory : public QItemEditorFactory |