Index: koPicture.cc =================================================================== RCS file: /home/kde/koffice/lib/kofficecore/koPicture.cc,v retrieving revision 1.14 diff -u -r1.14 koPicture.cc --- koPicture.cc 2002/06/22 20:03:59 1.14 +++ koPicture.cc 2002/07/26 19:51:22 @@ -59,8 +59,12 @@ void KoPicture::unlinkSharedData(void) { - if (m_sharedData && m_sharedData->deref()) - delete m_sharedData; + if (m_sharedData) + { + m_sharedData->m_shareCount--; + if (!m_sharedData->m_shareCount) + delete m_sharedData; + } m_sharedData=NULL; } @@ -68,7 +72,7 @@ void KoPicture::linkSharedData(void) const { if (m_sharedData) - m_sharedData->ref(); + m_sharedData->m_shareCount++; } void KoPicture::createSharedData(void) Index: koPictureShared.cc =================================================================== RCS file: /home/kde/koffice/lib/kofficecore/koPictureShared.cc,v retrieving revision 1.12 diff -u -r1.12 koPictureShared.cc --- koPictureShared.cc 2002/07/12 21:09:28 1.12 +++ koPictureShared.cc 2002/07/26 19:51:23 @@ -30,7 +30,7 @@ #include "koPictureClipart.h" #include "koPictureShared.h" -KoPictureShared::KoPictureShared(void) : m_base(NULL) +KoPictureShared::KoPictureShared(void) : m_shareCount(0), m_base(NULL) { } @@ -41,7 +41,6 @@ } KoPictureShared::KoPictureShared(const KoPictureShared &other) - : QShared() // Some compilers want it explicitely! { // We need to use newCopy, because we want a real copy, not just a copy of the part of KoPictureBase if (other.m_base) Index: koPictureShared.h =================================================================== RCS file: /home/kde/koffice/lib/kofficecore/koPictureShared.h,v retrieving revision 1.10 diff -u -r1.10 koPictureShared.h --- koPictureShared.h 2002/07/12 21:09:28 1.10 +++ koPictureShared.h 2002/07/26 19:51:23 @@ -36,9 +36,9 @@ * @internal * KoPictureShared is the class that contains the shared part for KoPicture * - * As with all QShared objects, the sharing is neither automatic nor transparent! + * Be careful the sharing is neither automatic nor transparent! */ -class KoPictureShared : public QShared +class KoPictureShared { public: /** @@ -154,13 +154,18 @@ * Load a WMF file (a .wmf file could be a QPicture file) */ bool loadWmf(QIODevice* io); - + /** * @internal * Loads a temporary file, probably from a downloaded file */ bool loadTmp(QIODevice* io); +public: + /** + * How many times this object is shared + */ + uint m_shareCount; protected: KoPictureBase* m_base; QString m_extension;