Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.7.0 Beta2
-
None
-
8a0787f3b (dev), 21dbb7800 (6.7)
Description
import QtQuick TextEdit { textDocument.source: "unsupportedResourceScheme.md" }
# Images that you can't load ![alt text](gopher://qt.io/icon48.png "some sort of fictitious icon") ![alt text](gopher://qt.io/icon24.png "another to attempt loading in parallel")
gopher is a protocol that we have never supported (and perhaps unsuitable for images anyway? not sure) so it will always fail; but you could substitute ftp (not currently supported) or even https if something is wrong with your ssl setup (as reported initially).
The problem is with one thread deleting a QQuickPixmap because the load job failed, while another thread still sees it in pixmapsInProgress:
void QQuickTextEdit::resourceRequestFinished() { Q_D(QQuickTextEdit); bool allDone = true; for (auto it = d->pixmapsInProgress.cbegin(); it != d->pixmapsInProgress.cend();) { auto *job = *it; if (job->isError()) { // <----- // get QTextDocument::loadResource() to call QQuickTextEdit::loadResource() again, to return the placeholder qCDebug(lcTextEdit) << "failed to load" << job->url(); d->document->resource(QTextDocument::ImageResource, job->url()); } else if (job->isReady()) { // get QTextDocument::loadResource() to call QQuickTextEdit::loadResource() again, and cache the result auto res = d->document->resource(QTextDocument::ImageResource, job->url()); // If QTextDocument::resource() returned a valid variant, it's been cached too. Either way, the job is done. qCDebug(lcTextEdit) << (res.isValid() ? "done downloading" : "failed to load") << job->url() << job->rect(); delete *it; // <------ it = d->pixmapsInProgress.erase(it); } else {