Thanks for your quick reply,
I've tried to change BeginInvokeOnMainThread to InvokeOnMainThread, but
still the same problem. The crash dump looks the same to me,
https://gist.github.com/Nordis/6129637
Then I tried to remove InvokeOnMainThread and only set the properties to
null,
searchController.Delegate = null;
searchController.SearchResultsDelegate = null;
searchController.SearchResultsSource = null;
But then I got this exception,
MonoTouch.UIKit.UIKitThreadAccessException: UIKit Consistency error: you
are calling a UIKit method that can only be invoked from the UI thread.
at MonoTouch.UIKit.UIApplication.EnsureUIThread () [0x00000] in <filename
unknown>:0
at MonoTouch.UIKit.UISearchDisplayController.set_WeakDelegate
(MonoTouch.Foundation.NSObject value) [0x00000] in <filename unknown>:0
at MonoTouch.UIKit.UISearchDisplayController.set_Delegate
(MonoTouch.UIKit.UISearchDisplayDelegate value) [0x00000] in <filename
unknown>:0
at Diet52App.FoodSearchBase.Dispose (Boolean disposing) [0x00000] in
<filename unknown>:0
at MonoTouch.Foundation.NSObject.Finalize () [0x00000] in <filename
unknown>:0
I got the idea to set searchController's properties to null by reading this
thread,
http://stackoverflow.com/questions/6708705/monotouch-sigsegv-crash-using-navigationcontroller-and-searchdisplaycontroller?rq=1
Best regards,
Daniel
2013/8/1 Nic Wise [via MonoTouch] <ml-node+s2284126n465840...@n4.nabble.com>
> Hi Nordis
>
> If I had to guess, I'd say this is the problem
>
> protected override void Dispose (bool disposing)
> {
> // Hopefully fixes SIGSEGV error
> //
> http://stackoverflow.com/questions/6708705/monotouch-sigsegv-crash-using-navigationcontroller-and-searchdisplaycontroller?rq=1
> BeginInvokeOnMainThread (() => {
> searchController.Delegate = null;
> searchController.SearchResultsDelegate = null;
> searchController.SearchResultsSource = null;
> });
> base.Dispose (disposing);
> }
>
>
> BeginInvokeOnMainThread will call it and return immediately - so your
> searchController may have been disposed of by the time the background
> thread runs.
>
> try changing it to either not use the call at all, or use
> InvokeOnMainThread, which waits for the code to execute before
> continuing.
>
>
> "Unlike NSObject.BeginInvokeOnMainThread(NSAction) this method waits
> for the main thread to execute the method, and does not return until
> the code pointed by action has completed running."
>
>
>
>
> On 1 August 2013 09:16, Nordis <[hidden
> email]<http://user/SendEmail.jtp?type=node&node=4658406&i=0>>
> wrote:
>
> > I'm having problem to find the cause of random crashes in my app. The
> crashes
> > only occurs when I build in release mode and run on a device like iPhone
> or
> > iPad. Running in debug on simulator no crashes occurs. My guess is that
> the
> > problem has something to do with these two lines in the crash log,
> >
> > 6 UIKit 0x34a193d0
> -[UISearchDisplayController
> > _destroyManagedTableView] + 68
> > 7 UIKit 0x34a2195a
> -[UISearchDisplayController
> > dealloc] + 94
> > I've uploaded the source code of my UITableViewController and the full
> crash
> > log here, https://gist.github.com/Nordis/6128735
> >
> > All help to track the cause of the crashes is much appreciated!
> >
> >
> >
> > --
> > View this message in context:
> http://monotouch.2284126.n4.nabble.com/Crash-related-to-UITableViewController-UISearchDisplayController-in-MonoTouch-Xamarin-iOS-tp4658405.html
> > Sent from the MonoTouch mailing list archive at Nabble.com.
> > _______________________________________________
> > MonoTouch mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4658406&i=1>
> > http://lists.ximian.com/mailman/listinfo/monotouch
>
>
>
> --
> Nic Wise
> t. +44 7788 592 806 | @fastchicken
> b. http://www.fastchicken.co.nz/
> _______________________________________________
> MonoTouch mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4658406&i=2>
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://monotouch.2284126.n4.nabble.com/Crash-related-to-UITableViewController-UISearchDisplayController-in-MonoTouch-Xamarin-iOS-tp4658405p4658406.html
> To unsubscribe from Crash related to UITableViewController /
> UISearchDisplayController in MonoTouch/Xamarin.iOS, click
> here<http://monotouch.2284126.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4658405&code=bm9yZG1hcmsuZGFuaWVsQGdtYWlsLmNvbXw0NjU4NDA1fDk0ODk5NDMwMg==>
> .
> NAML<http://monotouch.2284126.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Crash-related-to-UITableViewController-UISearchDisplayController-in-MonoTouch-Xamarin-iOS-tp4658405p4658407.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch