My problem is when I double tab the row it calls the call back to add the view to the navigation controller. Not sure this the best way to do it. I have put the sleeps in as in the other script I'm working on I do some processing before I push the view on, so I am simulating that with sleeps.

So if I double tap on the row and wait like 5 seconds after the view is pushed it crashes pythonista.

Anyway I know what the error is as I have the fault handler and exception catching script on so it produces this.

I have left the stack trace out. Now so I can see the issue but I don't know how to get around this from occurring. It appears to only happen when I have decorated the function to push the view on the navigation view in a ui.in_background

@ccc The reason I had the sleeps in was to pause the code. In the other code where I had the problem it doesn't use them, so haven't really tried to change that example.

What I did do though in my other code I needed console.alert in those methods which required me to have ui.inbackground otherwise it locked up (from memory anyway it was a while since I wrote that bit). Anyway my work around that seems to be working is to write another function that just shows the alert and decorate that with ui.in_background and remove it from the function that does the pushing of the view and call the alert function.

By the way, it is very confusing if the user presses a button, then some long time later the view changes. If you have lots of heavy computation to populate the view, instead of waiting until it is ready, try to push an empty view first, fill it with a ui.ActivityIndicator, THEN call a long background computation to fill it in with content. This prevents the user from mashing rows in the tableview trying to get something to happen.

Or, if you are not sure whether you will push the view until doing the long computation, "disarm" the table as soon as the user selects a row, and "rearm" it when computation is done. This would be done in the tableview_did_select, assuming your source has a new armed attribute.