Bug 13703 - UISearchDisplayController dealloc, when using a search bar in UITableViewController.
Summary: UISearchDisplayController dealloc, when using a search bar in UITableViewCont...
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2013-08-02 04:08 UTC by Daniel Nordmark
Modified: 2013-08-02 08:01 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Test case project (3.29 MB, application/zip)
2013-08-02 04:08 UTC, Daniel Nordmark
Crash log (61.58 KB, text/plain)
2013-08-02 04:10 UTC, Daniel Nordmark

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Daniel Nordmark 2013-08-02 04:08:28 UTC
Created attachment 4519 [details]
Test case project

According to this thread on StackOverflow,


Applying the fix suggested by Rolf Bjarne Kvinge doesn't help. I have this problem in a new project and haven't been able to resolve this. My app still crashes randomly. So I downloaded the test case discussed in the thread on StackOverflow, applied the fix. But sill the app crashes with exactly the same error as my app.

To reproduce:

* Start the project in a simulator, with debug.
* Press "From"
* Type something in the search bar
* Click on any of the results.
* Repeat until crash.


The bug in the test case seems to happen more often if xamarin studio is attached to the process.
I have also discussed this problem here,


Please let me know if you're interested in seeing any of my crash logs, I have lots of them. :-/
Comment 1 Daniel Nordmark 2013-08-02 04:10:07 UTC
Created attachment 4520 [details]
Crash log
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-08-02 06:49:39 UTC
The test case seems to work if I move the code from FromTableController.Dispose to FromTableController.ViewDidDisappear:

public override void ViewDidDisappear (bool animated)
	base.ViewDidDisappear (animated);

	searchController.SearchResultsSource = null;
	searchController.Delegate = null;

Can you try this to see if it works for you?
Comment 3 Daniel Nordmark 2013-08-02 07:46:41 UTC
Wow, thanks Rolf!

That worked both in the test case and also in my real app. 

You're a true coding hero! I've been trying to solve this for a couple of days and you fixed the problem right away, you have no idea how glad I am right now! :-)
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-08-02 07:56:50 UTC
That's great :)

Unfortunately this is a bug in Apple's code, not ours, and I don't believe there's a good way we can fix it for our users (in short Apple stores unretained references to objects, and depending on which order the objects in question are released, freed objects may end up getting accessed, thus crashing).
Comment 5 Daniel Nordmark 2013-08-02 08:01:21 UTC
I'm just happy that there was a solution. I've updated both my thread on StackOverflow and on Xamarin forum with the solution, it's also a link to this bug report on both forums. So hopefully people encounter this bug is able to find your answer.

Once again, thanks and have a great weekend!