Don't check reference count in QLinkedList<T>::free
authorJoão Abecasis <joao.abecasis@nokia.com>
Thu, 10 Nov 2011 17:13:36 +0000 (18:13 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 17 Jan 2012 09:17:01 +0000 (10:17 +0100)
commit301f7b780cbb0e5b1f6c9bf88bdb7dffe9b1110e
tree67392c05fccecdeaee6b432c6cf670361982462c
parentb3a4d3e328a3d80d4728716f2e5e68817b82cbb8
Don't check reference count in QLinkedList<T>::free

This is a private function that was always* called after d->ref.deref()
returned false to free the linked list. Still, it needlessly verified
the reference count to be zero.

The check is thus replaced with a Q_ASSERT to check the invariant on
debug builds.

*This commit also fixes an issue where free would be called on a block
that hadn't been deref'ed, thus leaking the nodes. Since this was in an
exception handling block, and happens before any code has a chance to
reference the block the explicit deref is skipped in that case.

Change-Id: Ie73c174d0a1b84f297bf5531e45f829e66a46346
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
src/corelib/tools/qlinkedlist.h