diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index 97298dde3d..16105530bf 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -43,9 +43,10 @@ QT_BEGIN_NAMESPACE -QLinkedListData QLinkedListData::shared_null = { - &QLinkedListData::shared_null, &QLinkedListData::shared_null, - Q_BASIC_ATOMIC_INITIALIZER(1), 0, true +const QLinkedListData QLinkedListData::shared_null = { + const_cast(&QLinkedListData::shared_null), + const_cast(&QLinkedListData::shared_null), + Q_REFCOUNT_INITIALIZER(-1), 0, true }; /*! \class QLinkedList diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 9f2834a7d7..bcad210d30 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -43,7 +43,7 @@ #define QLINKEDLIST_H #include -#include +#include #ifndef QT_NO_STL #include @@ -59,11 +59,11 @@ QT_MODULE(Core) struct Q_CORE_EXPORT QLinkedListData { QLinkedListData *n, *p; - QBasicAtomicInt ref; + QtPrivate::RefCount ref; int size; uint sharable : 1; - static QLinkedListData shared_null; + static const QLinkedListData shared_null; }; template @@ -81,7 +81,7 @@ class QLinkedList union { QLinkedListData *d; QLinkedListNode *e; }; public: - inline QLinkedList() : d(&QLinkedListData::shared_null) { d->ref.ref(); } + inline QLinkedList() : d(const_cast(&QLinkedListData::shared_null)) { } inline QLinkedList(const QLinkedList &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach(); } ~QLinkedList(); QLinkedList &operator=(const QLinkedList &);