diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-09 18:50:49 -0700 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-12 23:01:32 -0700 |
commit | 8a0787f3bbed226785c842e1fd273a5b6dc06a32 (patch) | |
tree | d7e9b32e971d1b6d90747de8949610689d273089 /src/qml/jsruntime | |
parent | d13c4979104d28e7e9abebfa35ded5b3dda35d37 (diff) |
Avoid dangling pointers in QQuickTextEdit::resourceRequestFinished()
If we encounter an error while trying to download a network resource
for a document (for example an inline image URL has an invalid protocol,
or the web server returns 404), we call QTextDocument::resource() one
more time, in case a placeholder image is to be returned. That will
call back to QQuickTextEdit::loadResource(), which will delete the
QQuickPixmap "job". Break out of the loop, don't keep iterating on
the same pixmapsInProgress list that we're deleting it from.
Likewise, break out if resourceRequestFinished() deletes the job itself.
So now we expect resourceRequestFinished() to run its loop more often
rather than continuing the first run until pixmapsInProgress is empty;
but as before, don't invalidate() until all resource-loading jobs are
done (pixmapsInProgress is empty).
Also, as a hypothetical improvement to thread safety, erase() from
the QList before deleting; and don't dereference the iterator again
when we've already done that once at the top.
Amends 7fb39a7accba014063e32ac41a58b77905bbd95b
turtle.svg for the autotest is from
https://openclipart.org/detail/235021/silhouette-turtle
Fixes: QTBUG-122108
Pick-to: 6.7
Change-Id: Icfcaba7b42c68b572efda15b1ddc791010701bfa
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
0 files changed, 0 insertions, 0 deletions