0

I am hoping to see if anyone knows anything about this issue and any potential workarounds.

I am using ArcGIS runtime SDK for Qt (100.2).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
    }
}
jp36
  • 1,873
  • 18
  • 28
  • Does it run fine when you don't use types from the ArcGISRuntime import? If so, you should file a bug report with the developers. If it still crashes, file a bug report with Qt. – Mitch Mar 20 '18 at 15:46
  • Yes, it runs fine with other types. I'll be filing a bug with them as soon as I can, but I was hoping for extra information/ideas for workarounds as I am unable to move forward and will not be able to wait on them to implement a fix. – jp36 Mar 20 '18 at 16:32
  • 1
    You could try creating the StackView items yourself, giving each one an `id` and pushing them that way, instead of e.g. pushing a Component or URL. That way, the StackView will know not to destroy them when they're popped off the stack. – Mitch Mar 20 '18 at 16:37
  • Thats an interesting idea. I'll probably try it out later today. The thing I'm currently trying is creating one instance in my main. then "reparenting" to each of the new components as they are loaded. What do you think of that as a workaround (it feels dirty)? – jp36 Mar 20 '18 at 16:46
  • 1
    Any workaround will probably feel dirty. :) I'm not sure what components you're loading or what the workaround looks like exactly, so it's hard to say. – Mitch Mar 20 '18 at 18:40

1 Answers1

1

This appears to be a bug in ArcGIS Runtime, so I logged a bug for this in our system. The only ways I can think to work around it are to not create/destroy the pages every time you navigate the stack.

  • For anyone curious, I solved this specifically by creating one instance in my main.qml then "reparenting" to each of the new components as they are loaded. So I still create and destroy my pages, but not the map itself which is just moved around to the pages as needed. – jp36 Apr 09 '18 at 14:00