[CIQBUG] simulator crash when accessing data field from App.onStop

I know this isn't really a normal usage scenario, but it still seems like a bug worth fixing.

I have a data field that gathers a lot of data over the duration of the session. For testing purposes, I wanted to summarize the results when the app exits (only on the simulator). To accomplish this, I just added methods to my data field that I call from the app object. When the app starts and stops, it calls through to the view to summarize the initial and final states to the debug console. Unfortunately, I see lots of crashes with this code.

It is my assumption that this crash occurs because the TestView instance owned by TestApp has somehow been deallocated before the TestApp's reference has been invalidated.

using Toybox.Application as App;
using Toybox.WatchUi as Ui;

class TestView extends Ui.DataField
{
function initialize() {
}

function onStart() {
}

function compute(dc) {
}

function onUpdate(dc) {
}

function onStop() {
}
}

class TestApp extends App.AppBase
{
hidden var view;

function initialize() {
view = new TestView();
}

function onStart() {
view.onStart();
}

function getInitialView() {
return [view];
}

function onStop() {
view.onStop(); // comment out to avoid crash
}
}


It seems to me that for the time being, the best solution for me is to pull the data out of the view class and into the app or an independent model class. From a reusability and testability perspective this is the right thing to do, so I have an ideal workaround.

Travis