Properly protect access to pixmap reader thread with mutex
authorChris Adams <christopher.adams@nokia.com>
Wed, 16 Nov 2011 03:20:45 +0000 (13:20 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 29 Nov 2011 06:09:01 +0000 (07:09 +0100)
commit328d1d2fd6cba7368230a1232e080d3f3310a7f1
treea8ca29ce66d937a6a40639cad14face3018cbd95
parent2e8059bfb80230d82bf98d7791b4dfc1d3706658
Properly protect access to pixmap reader thread with mutex

Previously, access to the reader thread wasn't guarded properly,
causing a crash when the reader thread was deleted prior to
QDeclarativePixmapData (which then attempted to dereference the
thread pointer to cancel the request).  This commit adds locking
to ensure that access to the reader is protected properly.

This commit also fixes an issue where if a QDeclarativePixmapData
was deleted after its QDeclarativePixmapReply was removed from the
jobs queue but prior to processing, a pointer to the data could
be dereferenced as part of processing, but caching the required
information in the reply.

Task-number: QTBUG-22125
Change-Id: I32aa2ca41a297b48e68cb358f4aa4fafd999f215
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/declarative/util/qdeclarativepixmapcache.cpp
tests/auto/declarative/qdeclarativepixmapcache/data/http/exists6.png [new file with mode: 0644]
tests/auto/declarative/qdeclarativepixmapcache/data/http/exists7.png [new file with mode: 0644]
tests/auto/declarative/qdeclarativepixmapcache/data/http/exists8.png [new file with mode: 0644]
tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
tests/auto/declarative/qquickimage/data/qtbug_22125.qml [new file with mode: 0644]
tests/auto/declarative/qquickimage/tst_qquickimage.cpp