[Development] Qt 5.2 Alpha possible issue with V4 and exposed Qml properties

Paul Lemire paullemire at hotmail.com
Fri Oct 11 17:29:18 CEST 2013

Hello everyone,

I've been working for quite some time on a Qt and QtQuick project and I  
tried the 5.2 alpha release as soon as it got out.
However, my project which didn't have any issues running with any previous  
5.* release of Qt now crashes with the alpha.

My project is composed of a core application that load Qt plugins through  
shared libraries. Those shared libraries are C++ backend that are exposed  
to the Qml Engine so as to be used by a matching QtQuick object loaded by  
a QtQuick loader.

Basically, foreach of my libraries I do :
context->setContextProperty(library_name, library_intance);
and each library has a associated qml file that is loaded through a loader  
and can then call the backend as it has been exposed to the Qml Engine  
(using library_name.my_method).

This C++ backend is mainly used to access web services, sql storage and  
manipulate ListModels (a custom subclass of QAbstractListModel) which are  
then shown with QtQuick ListView(s).

After debugging for quite some time, it appears that when one of those  
libraries tries to access and manipulate a ListModel that is bound to a  
qml ListView or Repeater, it produces a SIGSEGV. Debugging with gdb, I  
found out that from one call to another my model instance would suddenly  
be marked as inacessible for no obvious reason.

On a side note, those models are not registered as qml properties but are  
returned as QObject* in a Q_INVOKABLE methods of the backend. If I want to  
use the model in a ListView, I then do :

	model : library_name.getMyModel();

I suspect this might be coming from the new V4 engine but I've been  
looking at JIRA and so far no one as a similar issue. I see several  
qv4methods in the stack calls preceding the segfault so as V4 is making  
its debuts with the alpha I can't help but think the issue as something to  
do with it...

Anyway I cannot submit a bug report yet as I don't really know what the  
issue is.
I'd be happy to hear your advice if any of you has encountered some  
strange behavior like this one with the 5.2 alpha releases

Thanks and have a nice week end

Paul Lemire

More information about the Development mailing list