Mapview crash on iOS

795
3
03-16-2018 03:43 PM
JamesPettitt
New Contributor

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.6
import QtQuick.Controls 1.4
import Esri.ArcGISRuntime 100.2
ApplicationWindow {
    id: appWindow
    width: 800
    height: 600
    title: "IosMapTest"
    Rectangle {
        id: backgroundRect
        anchors.fill: parent
        color: "red"
    }
    Loader {
        id: mapLoader
        anchors.fill: parent
        // add a mapView component
        sourceComponent: MapView {
            anchors.fill: parent
            // set focus to enable keyboard navigation
            focus: true
            // add a map to the mapview
            Map {
                // add the BasemapTopographic basemap to the map
                BasemapTopographic {}
            }
        }
    }
    Button {
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        text: "click here for crash"
        onClicked: mapLoader.sourceComponent = undefined
    }
}
0 Kudos
3 Replies
LucasDanzinger
Esri Frequent Contributor

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

0 Kudos
LucasDanzinger
Esri Frequent Contributor

As a workaround, can you hold onto the MapView in a var somewhere that you know it won't get deleted?

0 Kudos
JamesPettitt
New Contributor

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.

0 Kudos