From 0c1fecfb2b5be1715a9f06e04f29a70079a4d664 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 19 Jul 2012 23:32:31 +0200 Subject: [PATCH] const_cast "this" instead of the member variable. --- src/core/Entry.cpp | 2 +- src/core/Group.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index 544f270d0..8da259e23 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -109,7 +109,7 @@ QPixmap Entry::iconPixmap() const if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) { // TODO: check if database() is 0 pixmap = QPixmap::fromImage(database()->metadata()->customIcon(m_data.customIcon)); - *const_cast(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap); + const_cast(this)->m_pixmapCacheKey = QPixmapCache::insert(pixmap); } return pixmap; diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 35492edac..6c41b369a 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -37,6 +37,8 @@ Group::~Group() { cleanupParent(); this->blockSignals(true); + // Destroy entries and children manually so DeletedObjects can be added + // to database. if (m_db && m_parent) { QList entries = m_entries; Q_FOREACH (Entry* entry, entries) { @@ -118,7 +120,7 @@ QPixmap Group::iconPixmap() const if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) { // TODO: check if m_db is 0 pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_customIcon)); - *const_cast(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap); + const_cast(this)->m_pixmapCacheKey = QPixmapCache::insert(pixmap); } return pixmap;