Bug 3418 - MenuItems of Menu don't get disposed
Summary: MenuItems of Menu don't get disposed
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: 2.10.x
Hardware: PC Linux
: Lowest normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-02-13 08:44 UTC by eb1
Modified: 2012-09-02 15:12 UTC (History)
3 users (show)

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


Attachments
Proposed fix (1.23 KB, patch)
2012-02-16 06:58 UTC, eb1
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 GitHub or Developer Community 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 FIXED

Description eb1 2012-02-13 08:44:03 UTC
When disposing a Menu its' menu items should also be disposed.

Currently they are not getting disposed when disposing the Menu but will eventually get garbage collected.
Comment 1 eb1 2012-02-16 06:58:50 UTC
Created attachment 1365 [details]
Proposed fix
Comment 2 Thomas Goldstein 2012-06-13 15:25:52 UTC
I committed this patch without the "menu_items = null;" line. Although this instruction may help the GC, it makes us differ from .NET. It makes it so trying to access a menu item after having disposed the menu throws a NullReferenceException, while .NET throws an ArgumentOutOfRangeException.

Patch: commit 6c3c219ad3ad435ec010d9b2c365a8d678d9c336
Unit test: commit 23bf99cf299cec7e42124cc75ebd261265f3540d