Bug 28505 - NSTabView.Delegate isn't holding on to reference correct on new ref count
Summary: NSTabView.Delegate isn't holding on to reference correct on new ref count
Status: VERIFIED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.12.0
Hardware: PC Mac OS
: High normal
Target Milestone: 2.0.x
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-03-27 16:26 UTC by Chris Hamons
Modified: 2015-04-17 11:29 UTC (History)
4 users (show)

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


Attachments
Repro (14.47 KB, application/zip)
2015-03-30 10:49 UTC, Chris Hamons
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:
VERIFIED FIXED

Description Chris Hamons 2015-03-27 16:26:47 UTC
See attached project. This hit the profiler.
Comment 1 Chris Hamons 2015-03-27 16:28:12 UTC
If you run it with new ref count, click the button and then swap tabs it will die.

If you change it to be

	x = new MyDel ();
        v.Delegate = x;

it does not die.

Loaded assembly: /Users/donblas/Programming/Local/NSTabViewDelegateBug/NSTabViewDelegateBug/bin/Debug/NSTabViewDelegateBug.app/Contents/MonoBundle/Xamarin.Mac.dll [External]
Loaded assembly: /Users/donblas/Programming/Local/NSTabViewDelegateBug/NSTabViewDelegateBug/bin/Debug/NSTabViewDelegateBug.app/Contents/MonoBundle/System.dll [External]
Loaded assembly: /Users/donblas/Programming/Local/NSTabViewDelegateBug/NSTabViewDelegateBug/bin/Debug/NSTabViewDelegateBug.app/Contents/MonoBundle/System.Net.Http.dll [External]
Loaded assembly: /Users/donblas/Programming/Local/NSTabViewDelegateBug/NSTabViewDelegateBug/bin/Debug/NSTabViewDelegateBug.app/Contents/MonoBundle/NSTabViewDelegateBug.exe
<NSTabViewItem '': 0x600000102760>
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain (int,string[]) <IL 0x00093, 0xffffffff>
  at AppKit.NSApplication.Main (string[]) [0x00041] in /Users/donblas/Programming/xamcore/src/AppKit/NSApplication.cs:106
  at NSTabViewDelegateBug.MainClass.Main (string[]) [0x00007] in /Users/donblas/Programming/Local/NSTabViewDelegateBug/NSTabViewDelegateBug/Main.cs:12
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:


Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.33dief'
Executing commands in '/private/tmp/mono-gdb-commands.33dief'.
(lldb) process attach --pid 44693
Comment 2 Chris Hamons 2015-03-30 10:49:19 UTC
Created attachment 10556 [details]
Repro
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-03-30 13:20:56 UTC
Fixed.

maccore/master: 918244e7fbc09c5f69f6dfc949b5c4ee88fc6ce4
maccore/macios-cycle5: 86e7cb57cb671d5a194d7c1f910c270a11af13aa
Comment 4 Udham Singh 2015-04-17 11:29:00 UTC
I have checked this issue with the help of sample app given in comment 2 and instructions provided in comment 1, and observed that now app does not die. Hence I am closing this issue.

Environment Info : 

Mac OS X 10.9.5
Xamarin Studio 5.9 (build 430)
Mono 4.0.0 ((detached/c8db1b0)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.2 (6776)
Xamarin.Mac 2.0.0.261 (Business Edition)

Screencast : http://www.screencast.com/t/RfKrplbI