The non-const functions here should call detach.
authorScott Wheeler <wheeler@kde.org>
Sun, 13 Aug 2006 12:29:26 +0000 (12:29 +0000)
committerScott Wheeler <wheeler@kde.org>
Sun, 13 Aug 2006 12:29:26 +0000 (12:29 +0000)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@572630 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

toolkit/tmap.tcc

index b9787a0f4dc66d5dddf2f3b84a4944b0e0d319f7..afb7db4ca6e6d577a1500ff09263b64dd07caee9 100644 (file)
@@ -106,6 +106,7 @@ bool Map<Key, T>::isEmpty() const
 template <class Key, class T>
 typename Map<Key, T>::Iterator Map<Key, T>::find(const Key &key)
 {
+  detach();
   return d->map.find(key);
 }
 
@@ -124,6 +125,7 @@ bool Map<Key, T>::contains(const Key &key) const
 template <class Key, class T>
 Map<Key, T> &Map<Key,T>::erase(Iterator it)
 {
+  detach();
   d->map.erase(it);
   return *this;
 }
@@ -143,7 +145,8 @@ const T &Map<Key, T>::operator[](const Key &key) const
 template <class Key, class T>
 T &Map<Key, T>::operator[](const Key &key)
 {
-    return d->map[key];
+  detach();  
+  return d->map[key];
 }
 
 template <class Key, class T>