mail-archives/mono-osx/2012-June/005018.html

184 строки
6.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] Exception disposing of object
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=Re%3A%20%5BMono-osx%5D%20Exception%20disposing%20of%20object&In-Reply-To=%3CCAMga9iTY8MMcrj%2BoyZrUqy0CyztBf7-EOXOkRspy_ZruUTa2%2BQ%40mail.gmail.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="005017.html">
<LINK REL="Next" HREF="005021.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] Exception disposing of object</H1>
<B>Michael Hutchinson</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=Re%3A%20%5BMono-osx%5D%20Exception%20disposing%20of%20object&In-Reply-To=%3CCAMga9iTY8MMcrj%2BoyZrUqy0CyztBf7-EOXOkRspy_ZruUTa2%2BQ%40mail.gmail.com%3E"
TITLE="[Mono-osx] Exception disposing of object">m.j.hutchinson at gmail.com
</A><BR>
<I>Wed Jun 13 18:38:21 UTC 2012</I>
<P><UL>
<LI>Previous message: <A HREF="005017.html">[Mono-osx] Exception disposing of object
</A></li>
<LI>Next message: <A HREF="005021.html">[Mono-osx] [Solved] Monomac &amp; Monodevel 3.0.2 problems (John Fourkiotis)
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#5018">[ date ]</a>
<a href="thread.html#5018">[ thread ]</a>
<a href="subject.html#5018">[ subject ]</a>
<a href="author.html#5018">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Could you please file a bug with the test project attached?
On 13 June 2012 14:31, Jon Lipsky &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">jon.lipsky at elevenworks.com</A>&gt; wrote:
&gt;<i> Hi All,
</I>&gt;<i>
</I>&gt;<i> I'm getting random crashes in my MonoMac application in the
</I>&gt;<i> &quot;NSObject.MonoMac_Disposer.Drain&quot; method:
</I>&gt;<i>
</I>&gt;<i> &#160;at (wrapper managed-to-native)
</I>&gt;<i> MonoMac.ObjCRuntime.Messaging.void_objc_msgSendSuper (intptr,intptr) &lt;IL
</I>&gt;<i> 0x00024, 0xffffffff&gt;
</I>&gt;<i> &#160; at MonoMac.Foundation.NSObject/MonoMac_Disposer.Drain
</I>&gt;<i> (MonoMac.Foundation.NSObject) [0x0003b] in
</I>&gt;<i> /Development/github/monomac/src/Foundation/NSObject.cs
</I>&gt;<i> &#160; at (wrapper dynamic-method)
</I>&gt;<i> object.[MonoMac.Foundation.NSObject+MonoMac_Disposer.Void
</I>&gt;<i> Drain(MonoMac.Foundation.NSObject)]
</I>&gt;<i> (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject)
</I>&gt;<i> &lt;IL 0x00011, 0x0004b&gt;
</I>&gt;<i> &#160; at (wrapper native-to-managed)
</I>&gt;<i> object.[MonoMac.Foundation.NSObject+MonoMac_Disposer.Void
</I>&gt;<i> Drain(MonoMac.Foundation.NSObject)]
</I>&gt;<i> (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject)
</I>&gt;<i> &lt;IL 0x000b6, 0xffffffff&gt;
</I>&gt;<i> &#160; at (wrapper managed-to-native)
</I>&gt;<i> MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) &lt;IL 0x0009d,
</I>&gt;<i> 0xffffffff&gt;
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> By building my own version of MonoMac, I've been able to figure out that
</I>&gt;<i> this crash always occurs when it's trying to dispose of the &quot;super_handle&quot;
</I>&gt;<i> of my NSWindow subclass.
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> Has anyone seen this? &#160;Am I doing something wrong, or could there possibly
</I>&gt;<i> be an issue with MonoMac here?
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> It's quite easy to reproduce this issue:
</I>&gt;<i>
</I>&gt;<i> 1) Create a new MonoMac document based project.
</I>&gt;<i>
</I>&gt;<i> 2) Create a subclass of NSWindow:
</I>&gt;<i>
</I>&gt;<i> using System;
</I>&gt;<i> using System.Collections.Generic;
</I>&gt;<i> using System.Drawing;
</I>&gt;<i> using MonoMac.AppKit;
</I>&gt;<i>
</I>&gt;<i> namespace DisposalProblem
</I>&gt;<i> {
</I>&gt;<i> public class TestWindow : NSWindow
</I>&gt;<i> {
</I>&gt;<i> public TestWindow () : base(new
</I>&gt;<i> RectangleF(100,100,500,500),NSWindowStyle.Resizable |
</I>&gt;<i> NSWindowStyle.Closable, NSBackingStore.Buffered, false)
</I>&gt;<i> {
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> public TestWindow (IntPtr aIntPtr) : base(aIntPtr)
</I>&gt;<i> {
</I>&gt;<i> }
</I>&gt;<i> }
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> 3) Use interface builder to have one of the pull down menus send the message
</I>&gt;<i> &quot;showTestWindow:&quot;.
</I>&gt;<i>
</I>&gt;<i> 4) Add the following to your AppDelegate class:
</I>&gt;<i>
</I>&gt;<i> private TestWindow testWindow;
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> [Export(&quot;showTestWindow:&quot;)]
</I>&gt;<i> public void ShowTestWindow()
</I>&gt;<i> {
</I>&gt;<i> if (testWindow == null)
</I>&gt;<i> {
</I>&gt;<i> testWindow = new TestWindow();
</I>&gt;<i> testWindow.WillClose += HandleWillClose;
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> testWindow.MakeKeyAndOrderFront(this);
</I>&gt;<i> testWindow.Center();
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i> void HandleWillClose (object sender, EventArgs e)
</I>&gt;<i> {
</I>&gt;<i> testWindow.WillClose -= HandleWillClose;
</I>&gt;<i> testWindow = null;
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i> 5) Run the application, and open and close the window using the &quot;wired up&quot;
</I>&gt;<i> menu item. &#160;Should take less than 20 seconds to make it crash.
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> Any help anyone could provide would be appreciated.
</I>&gt;<i>
</I>&gt;<i> Thanks,
</I>&gt;<i> Jon...
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> _______________________________________________
</I>&gt;<i> Mono-osx mailing list
</I>&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">Mono-osx at lists.ximian.com</A>
</I>&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">http://lists.ximian.com/mailman/listinfo/mono-osx</A>
</I>&gt;<i>
</I>
--
Michael Hutchinson
<A HREF="http://mjhutchinson.com">http://mjhutchinson.com</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="005017.html">[Mono-osx] Exception disposing of object
</A></li>
<LI>Next message: <A HREF="005021.html">[Mono-osx] [Solved] Monomac &amp; Monodevel 3.0.2 problems (John Fourkiotis)
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#5018">[ date ]</a>
<a href="thread.html#5018">[ thread ]</a>
<a href="subject.html#5018">[ subject ]</a>
<a href="author.html#5018">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
mailing list</a><br>
</body></html>