Bug 10889 - controller's will get GC'd, even if their view is added to the view hierarchy
Summary: controller's will get GC'd, even if their view is added to the view hierarchy
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- critical
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-04 16:33 UTC by bryan costanich
Modified: 2014-03-20 17:09 UTC (History)
2 users (show)

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


Attachments
solution file (20.26 KB, application/zip)
2013-03-04 16:33 UTC, bryan costanich
Details


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:
Status:
RESOLVED NOT_REPRODUCIBLE

Description bryan costanich 2013-03-04 16:33:08 UTC
Created attachment 3534 [details]
solution file

If you create a new controller in a method (rather than at class level), and then add it's view to the a view that is alive, eventually, that controller will get GC'd, causing your application to crash.

for instance. consider the following code inside a window:
public override void AwakeFromNib ()
{
	base.AwakeFromNib ();
	OutlineViewController outlineViewController;
	outlineViewController = new OutlineViewController ( this.Window.ContentView.Bounds);
	this.Window.ContentView.AddSubview (outlineViewController.View);
}

after running this for a bit, Xam.mac will clean up the reference to OutlineViewController, even though the controller's view has been added to Window.ContentView via AddSubview.

To repro, run attached application, expand some nodes in the outline view, wait a bit, and then try expanding/collapsing some more.
Comment 1 Chris Hamons 2014-03-20 17:09:39 UTC
This appears to have been fixed with our 1.6 release. I have 1.6.27 and am unable to reproduce. Please try it out and let me know if you can still reproduce.