I am hoping to see if anyone knows anything about this issue and any potential workarounds.
The issue is that if a mapview with a map inside of it is created and later destroyed it crashes with the below message:
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0x174329f60. Receiver '' (of type 'QRTImpl::LocationDisplayImpl') was created in thread 0x0x17001d940", file kernel/qcoreapplication
.cpp, line 563
This does not happen on Mac or Android. The usecase I have for this is creating a map in a component loaded up in a stackView. When I navigate away from that component the stackview kills the mapview which causes the crash. I created an Empty ArcGIS qml app for testing this issue in a more simple way by showing the map in a loader with a button that "unloads" it. See the bottom of the post for a simple example.
import QtQuick 2.6import QtQuick.Controls 1.4
import Esri.ArcGISRuntime 100.2ApplicationWindow {
id: appWindowwidth: 800height: 600title: "IosMapTest"Rectangle {id: backgroundRectanchors.fill: parentcolor: "red"}
Loader {id: mapLoaderanchors.fill: parent// add a mapView componentsourceComponent: MapView {anchors.fill: parent// set focus to enable keyboard navigationfocus: true// add a map to the mapviewMap {// add the BasemapTopographic basemap to the mapBasemapTopographic {}}
}
}
Button {anchors.bottom: parent.bottomanchors.right: parent.righttext: "click here for crash"onClicked: mapLoader.sourceComponent = undefined}
}
I don't have any suggested workarounds at the moment, but I can reproduce the crash. Can you please log a support case with Esri support so we can get a official bug logged? Thanks
-Luke
As a workaround, can you hold onto the MapView in a var somewhere that you know it won't get deleted?
Thats what I ended up doing to work around this. I create the map in my main.qml file then reparent and anchors.fill it to my components as they need to display a map.