path: root/src/corelib/tools/qlist.cpp
diff options
authorThiago Macieira <>2012-08-08 14:44:51 +0200
committerQt by Nokia <>2012-08-09 03:26:05 +0200
commit649cd987439d87875c05983908823aa3062cdee9 (patch)
tree76b32ac0b6e8e05069a11bfb42288c999b538559 /src/corelib/tools/qlist.cpp
parent1ecef1ea354c539ca57532a2944bcaa9842db500 (diff)
Remove use of ::free from qlist.h
The memory is allocated in qlist.cpp, so it should be freed in qlist.cpp. Freeing it in qlist.cpp ties our hands about future improvements to the allocator. In addition, silence the warning by the too-smart-for-its-own-good GCC that we're trying to free a non-heap object: qlist.h:763:14: warning: attempt to free a non-heap object "QListData::shared_null" [-Wfree-nonheap-object] The warning is wrong. It should say "possibly" somewhere because GCC failed to account for all conditions in the path to free(). Change-Id: I34a6c16bba9a2197fc83eb3c7a63ae06fb25bf15 Reviewed-by: Lars Knoll <>
Diffstat (limited to 'src/corelib/tools/qlist.cpp')
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 72924ef84c..ad33010faf 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -154,6 +154,12 @@ void QListData::realloc(int alloc)
d->begin = d->end = 0;
+void QListData::dispose(Data *d)
+ Q_ASSERT(!d->ref.isShared());
+ free(d);
// ensures that enough space is available to append n elements
void **QListData::append(int n)