Hi everyone,

for a QtQuick application I try to implement an asynchronous image provider.
As suggested in the documentation of QQuickImageResponse I use QRunnable as
base class and disabled automatic deletion in the constructor.

I have a private QThreadPool member in my QQuickAsyncImageProvider.
My requestImageResponse function creates a new ImageResponse, calling
the ThreadPool´s start function for the ImageResponse and returns the

The run method of the ImageResponse renders a pdf page with poppler, sets
the QQuickTextureFactory and emits finished.

To display the pdf pages I use a ListModel with all pages displayed as
Images in a PathView. To display different pdf´s i use a StackView.

If I push a pdf view on the StackView I can see the construction, run,
finished, textureFactory and destruction calls of the ImageResponse.
In the ImageResponse I added qDebug() prints for all public functions.
The pages get displayed correctly in my pdf view.

If I pop the pdf view from the StackView before all pages have been rendered
the application crashes.
I can see a call to cancel and destructor of the pages that have not signaled
finished. To eliminate side effects, I replaced the pdf rendering in run with
a sleep of 1 second.

Here is the output of a 7 page pdf view (the second column is the requested
id (fileName:pageNumber), stored in a private member of ImageRequest):

QML debugging is enabled. Only use this in a safe environment.
constructor:    "test.pdf:4"
constructor:    "test.pdf:5"
run:            "test.pdf:4"
constructor:    "test.pdf:6"
run:            "test.pdf:5"
constructor:    "test.pdf:3"
constructor:    "test.pdf:2"
constructor:    "test.pdf:1"
run:            "test.pdf:3"
constructor:    "test.pdf:0"
run:            "test.pdf:6"
run finished:   "test.pdf:4"
run:            "test.pdf:2"
run finished:   "test.pdf:5"
textureFactory:         "test.pdf:4"
run:            "test.pdf:1"
textureFactory:         "test.pdf:5"
destructor:     "test.pdf:4"
run finished:   "test.pdf:3"
run:            "test.pdf:0"
destructor:     "test.pdf:5"
textureFactory:         "test.pdf:3"
destructor:     "test.pdf:3"
run finished:   "test.pdf:6"
textureFactory:         "test.pdf:6"
destructor:     "test.pdf:6"
cancle:                 "test.pdf:0"
destructor:     "test.pdf:0"
cancle:                 "test.pdf:1"
cancle:                 "test.pdf:2"
destructor:     "test.pdf:1"
destructor:     "test.pdf:2"
run finished:   "test.pdf:2"
run finished:   "test.pdf:1"
bash: line 1: 14884 Segmentation fault      DISPLAY=':0.0' 

The only thing I can spot is the destruction of ImageRequests that have been 
started but not finished
(the last 4 lines before the segmentation fault).

Do I miss something or is this a bug?



Bruehlmatten 3a - 9
D-79295 Sulzburg
Reg.-Ger. Freiburg HRB 300243
Michael Roth, Armin Berchtold
Telefon +49 7634 500-0
Telefax +49 7634 500-316
Interest mailing list

Reply via email to