Bug 23378 - Surfaced buttons via this.Window.StandardWindowButton are not kept in memory
Summary: Surfaced buttons via this.Window.StandardWindowButton are not kept in memory
Status: VERIFIED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) (show other bugs)
Version: Master
Hardware: PC Mac OS
: Normal normal
Target Milestone: 2.0.x
Assignee: Timothy Risi
URL:
Depends on:
Blocks:
 
Reported: 2014-09-25 13:39 UTC by Chris Hamons
Modified: 2015-03-03 10:56 UTC (History)
3 users (show)

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

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 2014-09-25 13:39:14 UTC
this.Window.StandardWindowButton(NSWindowButton.CloseButton).Activated += (object sender, EventArgs e) => {
Console.WriteLine (foo); }

GC.Collect(2);

Crash.
Comment 1 Prashant manu 2014-09-30 06:08:32 UTC
Could you please provide us the test steps/directions to check this issue?
Comment 2 Chris Hamons 2014-09-30 10:52:20 UTC
Create an app with a button

Have this code in the awake from nib:

this.Window.StandardWindowButton(NSWindowButton.CloseButton).Activated +=
(object sender, EventArgs e) => {
Console.WriteLine (foo); }

Have the button gc.collect(2);

Launch
Click button
Click close button
You should crash since the called back button returned from this.Window.StandardWindowButton was collected.
Comment 3 Timothy Risi 2015-01-22 13:11:06 UTC
Fixed by 404818344509598c1dbec3e9693ad95a3536ec8e
Comment 4 Rajneesh Kumar 2015-03-03 10:56:56 UTC
I have checked this issue with the following builds:

=== Xamarin Studio ===
Version 5.8 (build 1043)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
Mono 4.0.0 ((detached/2634099)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000017
Apple Developer Tools Xcode 6.1 (6604)
Build 6A1052d
Xamarin.Mac Version: 1.13.1.417 (Business Edition)
=== Build Information ===
Release ID: 508001043
Git revision: eeba4b77cc5ab021f9c5e2bddf16272e1f6b75d9
Build date: 2015-03-02 06:49:10-05
Xamarin addins: a58814e6e6034bf1169e758b92ead093a3f40404
Operating System Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
Sun Aug 17 19:50:11 PDT 2014
root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

This issue is working fine now. To check this issue I have used the code provided in bug description. Launching the application and Clicking button, then Clicking close button not getting any type of crash or exception. Please refer the screencast for the same.
http://www.screencast.com/t/gp0GQt2oth

This issue has been fixed hence, I am closing this issue.