[Mono-osx] Need a replacement for NSWindow.Close()
gnorton at novell.com
Tue Mar 29 11:10:17 EDT 2011
I think you're confused what .Close () does. Since it specifically calls out it does not call WillClose either:
Anyways, the issue with .Close is it does a .Release under the hood, that we aren't aware of, leading to a double free.
On 2011-03-29, at 10:58 AM, Maxi Combina wrote:
> .OrderOut() and .Close() don't seem to be equivallent:
> If I use Window.OrderOut() then the Window.WillClose() is not dispatched.
> I can not invoke PerformClose() since I use Borderless windows.
> I found 2 ideas, please advise me on those:
> 1) To have my own events: I use .OrderOut() and launch a custom event, to replace WillClose().
> 2) I code:
> StyleMask = Titled | Closable; // enable PerformClose()
> PerformClose(this) // Close the already hidden window
> Or maybe I should refactor.
> Is it just me that finds the missing .Close() a little odd?
> 2011/3/29 Geoff Norton <gnorton at novell.com>
> Use .OrderOut ()
> On 2011-03-29, at 5:54 AM, Maxi Combina wrote:
>> I have a Borderless window which can not be closed with PerformClose(), since this method (as per Apple documentation) "simulates the user clicking the close button" and "if the windows doesn't ahve a close button or can't be closed [...], the system emits the alert sound".
>> For closing a window I used the "Close()" method. But in the current src/appkit.cs the "Close()" is commented out:
>> /* NSWindow.Close by default calls [window release]
>> * This will cause a double free in our code since we're not aware of this
>> * and we end up GCing the proxy eventually and sending our own release
>> * Removing this method for now
>> [Export ("close")]
>> void Close ();
>> I am looking for a way of closing (and releasing) the window.
>> Any ideas?
>> Maxi Combina
>> Cell:+1 408 300 3614
>> Tel: +1 408 524 1579
>> 440 N. Wolfe Road. Sunnyvale. CA. 94085. USA
>> This message and its attachments are sent from PasswordBank, Inc. and may contain information that is
>> confidential. If you are not the intended recipient, you are prohibited from printing, copying, forwarding or
>> saving them. Please delete the message and attachments without printing, copying, forwarding or saving
>> them, and notify the sender immediately. Message transmission is not guaranteed to be secure.
>> Mono-osx mailing list
>> Mono-osx at lists.ximian.com
> Maxi Combina
> Cell:+1 408 300 3614
> Tel: +1 408 524 1579
> 440 N. Wolfe Road. Sunnyvale. CA. 94085. USA
> This message and its attachments are sent from PasswordBank, Inc. and may contain information that is
> confidential. If you are not the intended recipient, you are prohibited from printing, copying, forwarding or
> saving them. Please delete the message and attachments without printing, copying, forwarding or saving
> them, and notify the sender immediately. Message transmission is not guaranteed to be secure.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-osx