[Mono-osx] Need a replacement for NSWindow.Close()
Geoff Norton
gnorton at novell.com
Tue Mar 29 11:24:05 EDT 2011
I've considered that, but it breaks the document contract, I'm still thinking about the best way to solve it, but since the functionality is easily accomplished in better ways, I've removed it for now.
-g
On 2011-03-29, at 11:17 AM, Duane Wandless wrote:
> Why not make use of isReleasedWhenClosed in a handwritten Close to mark the object as freed and then not release the object from the MM code?
>
> Duane
>
> On Tue, Mar 29, 2011 at 11:10 AM, Geoff Norton <gnorton at novell.com> wrote:
> I think you're confused what .Close () does. Since it specifically calls out it does not call WillClose either:
>
> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html
>
> Anyways, the issue with .Close is it does a .Release under the hood, that we aren't aware of, leading to a double free.
>
> -g
>
> 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:
>> OrderOut();
>> 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?
>>
>> Bests,
>> Maxi
>>
>> 2011/3/29 Geoff Norton <gnorton at novell.com>
>> Use .OrderOut ()
>>
>> -g
>>
>> On 2011-03-29, at 5:54 AM, Maxi Combina wrote:
>>
>>> Hello,
>>>
>>> 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?
>>>
>>> Thanks!
>>> maxi
>>>
>>> --
>>> Maxi Combina
>>> Cell:+1 408 300 3614
>>> Tel: +1 408 524 1579
>>> 440 N. Wolfe Road. Sunnyvale. CA. 94085. USA
>>>
>>> www.PasswordBank.com
>>>
>>> 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
>>> http://lists.ximian.com/mailman/listinfo/mono-osx
>>
>>
>>
>>
>> --
>> Maxi Combina
>> Cell:+1 408 300 3614
>> Tel: +1 408 524 1579
>> 440 N. Wolfe Road. Sunnyvale. CA. 94085. USA
>>
>> www.PasswordBank.com
>>
>> 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
> http://lists.ximian.com/mailman/listinfo/mono-osx
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110329/4c7f9187/attachment.html
More information about the Mono-osx
mailing list