Code review comment for lp:~fboucault/ubuntu-ui-toolkit/ubuntu_colors

Revision history for this message
Zsombor Egri (zsombi) wrote :

> When closing gallery, the qmlscene does not exit (the prompt in terminal is
> not retrieved).

Actually the following code causes the trouble:
419 +QObject* QuickUtils::createQmlObject(const QUrl &url)
420 +{
421 + /* FIXME: if the directory pointed to by url contains a qmldir file that
422 + declares a JavaScript module then QQmlComponent::create() fails with
423 + the error "QQmlComponent: Component is not ready".
424 + */
425 + static QQmlEngine engine;
426 + QQmlComponent *component = new QQmlComponent(&engine, url, QQmlComponent::PreferSynchronous);
427 + QObject* result = component->create();
428 + delete component;
429 + return result;
430 +}

Having a quick look on the call stack seems to hang on the static QQmlEngien cleanup:

0 pthread_cond_wait@@GLIBC_2.3.2 185 0x7ffff4815ca4
1 QWaitCondition::wait(QMutex*, unsigned long) /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 0x7ffff611e4fb
2 ?? /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff75a940a
3 ?? /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff75398f9
4 QQmlEnginePrivate::~QQmlEnginePrivate() /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff74e76d3
5 QQmlEnginePrivate::~QQmlEnginePrivate() /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff74e7ab9
6 QObject::~QObject() /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 0x7ffff62c5398
7 QQmlEngine::~QQmlEngine() /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff74e40a9
8 __run_exit_handlers 77 0x7ffff5701121
9 __GI_exit 99 0x7ffff57011a5
10 __libc_start_main 294 0x7ffff56e6eac
11 ?? 0x40629d

So the static QQmlEngine causes the hang when closing qmlscene. I did some small prototyping with using the plugin's QmlEngine, but then a second call on createQmlObject() causes "QQmlComponent: Component not ready" error, which is somewhat anticipated as we are trying to instantiate a component in the plugin's registration stage (we had this kind of error in the early times of the plugin creation with the theming engine).

Connecting the static engine's quit() signal to the parent one's does not help either. Therefore seems we need a different way of creating the UbuntuColors component.

review: Needs Fixing

« Back to merge proposal