Comment 16 for bug 1368492

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The real reason for this bug has been hiding in plain sight on this page all the time. Note the backtrace above:

#5 0xacf9b466 in ThumbnailGenerator::requestImage(QString const&, QSize*, QSize const&) ()
   from /usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/libUbuntuComponents.so

This means that the thumbnailer plugin is invoked from libUbuntuComponents.so, which is provided by ubuntu-ui-toolkit and *not* from the plugin provided by thumbnailer. And, sure enough, in modules/Ubuntu/Components/plugin/plugin.cp we find this:

    try {
        engine->addImageProvider(QLatin1String("thumbnailer"), new ThumbnailGenerator);
    } catch(std::runtime_error &e) {
        qDebug() << "Could not create thumbnailer: " << e.what();
    }

This same piece of code can also be found in plugins/Ubuntu/Thumbnailer/plugin.cpp (along with the other two generators it provides.

A quick test shows that removing the registration code from thumbnailer makes these threading bugs disappear. Apparently what happens is that if you register the same image provider into Qt twice, it gets confused and starts corrupting its own data structures.

A side effect of this fix is that when you tap on a picture in the gallery app to bring it full screen, pinch-to-zoom no longer works and there is other weirdness (sometimes the image goes fully black). (As an aside, why is gallery even using the thumbnailer for this? You need the entire image for proper zooming so why not just open it directly?)

To get this fixed we need to do the following:

- decide with UI toolkit people on where the correct place for thumbnail image provider is
- once done we need to verify if the pinching bug still happens and fix it
- land all MRs dealing with the above as one clump