Details
-
Bug
-
Resolution: Invalid
-
P1: Critical
-
None
-
5.6, 5.9.2
-
None
-
* Qt: 5.9.2, 5.6;
* OS: MacOs High Sierra (10.13), Android 4.2.
Description
For some reason when a MapItemView removes items related to object created with a Q_INVOKABLE it crashes.
Attached there is a simple project to reproduce the crash.
To program has a Map with a MapItemView that shows some markes, based on a c++ model, and two buttons (connected to two Q_INVOKABLEs in the model), one to add data, and one to reset them. The model is exposed as a context property.
At startup such model is filled with some mocked data from the c++, so if you click on "add data" OR "reset" it works, but as soon as data are added with the Q_INVOKABLE call (button to add data), any subsequent action (add/reset) results in a crash when the MapItemView tries to remove previously instantiated objects.
A possible (really dirty) workaround is to set the view's model to undefined, add data and reset it to the correct context property.
The debugged shows this:
```
1 QDeclarativeGeoMapItemView::removeInstantiatedItems() 0x10cc6a1a0
2 QDeclarativeGeoMapItemView::itemModelReset() 0x10cc6ae5e
3 QMetaObject::activate(QObject *, int, int, void * *) 0x100b3fab1
4 QAbstractItemModel::endResetModel() 0x100abf784
5 LocationsModel::reset() LocationsModel.cpp 65 0x10000596b
6 LocationsModel::qt_static_metacall(QObject *, QMetaObject::Call, int, void * *) moc_LocationsModel.cpp 86 0x100006d25
7 LocationsModel::qt_metacall(QMetaObject::Call, int, void * *) moc_LocationsModel.cpp 119 0x100006ed5
8 CallMethod(QQmlObjectOrGadget const&, int, int, int, int *, QV4::ExecutionEngine *, QV4::CallData *, QMetaObject::Call) 0x1005ccdd2
9 CallPrecise(QQmlObjectOrGadget const&, QQmlPropertyData const&, QV4::ExecutionEngine *, QV4::CallData *, QMetaObject::Call) 0x1005cb671
10 QV4::QObjectMethod::callInternal(QV4::CallData *, QV4::Scope&) const 0x1005caff0
11 QV4::Runtime::method_callProperty(QV4::ExecutionEngine *, int, QV4::CallData *) 0x1005ded4a
12 QV4::Moth::VME::run(QV4::ExecutionEngine *, unsigned const char *) 0x1005db554
13 QV4::Moth::VME::exec(QV4::ExecutionEngine *, unsigned const char *) 0x1005dd180
14 QV4::ExecutionContext::call(QV4::Scope&, QV4::CallData *, QV4::Function *, QV4::FunctionObject const *) 0x10054ac7c
15 QQmlJavaScriptExpression::evaluate(QV4::CallData *, bool *, QV4::Scope&) 0x10067c2cc
16 QQmlBoundSignalExpression::evaluate(void * *) 0x1006139b7
17 QQmlBoundSignal_callback(QQmlNotifierEndpoint *, void * *) 0x10061417d
18 QQmlNotifier::emitNotify(QQmlNotifierEndpoint *, void * *) 0x10065d37d
19 QMetaObject::activate(QObject *, int, int, void * *) 0x100b3f799
20 QQuickAbstractButtonPrivate::handleRelease(QPointF const&) 0x10ca72741
... <More>
```