-[NSApp orderOut:] leaves custom sheet in -orderedWindows

  • Mac app here, 10.7.

    • Show a custom sheet (window) on a document window.
    • Send it an -orderOut:
    • Send [NSApp endSheet:returnCode:]

    Expected Result:
    • Sheet should be completely removed from [NSApp orderedWindows].

    Actual Result:
    • It is moved to the end of [NSApp orderedWindows].

    This sheet has isReleasedWhenClosed:NO and is subclassed directly from NSWindow, not NSPanel.  However, I don't think that matters, unless NSApp is watching its retainCount, which would be turning the world upside down.

    What is necessary to get rid of a custom sheet, for good?

    Thanks

    Jerry Krinock
  • This is probably on the way to being solved.  It looks like my custom sheet's window controller is hanging around too.
  • On Sat, 5 May 2012 10:27:56 -0700, Jerry Krinock said:

    > Mac app here, 10.7.
    >
    > • Show a custom sheet (window) on a document window.
    > • Send it an -orderOut:
    > • Send [NSApp endSheet:returnCode:]
    >
    > Expected Result:
    > • Sheet should be completely removed from [NSApp orderedWindows].
    >
    > Actual Result:
    > • It is moved to the end of [NSApp orderedWindows].
    >
    > This sheet has isReleasedWhenClosed:NO and is subclassed directly from
    > NSWindow, not NSPanel.  However, I don't think that matters, unless
    > NSApp is watching its retainCount, which would be turning the world
    > upside down.

    Are you using GC?

    Sounds a bit like something I saw the other day.  I close a window and "shortly" after invoke [NSApp windows] and lo and behold the window I closed is still there, for some definitions of "shortly".  If enough time passes, the garbage collector does some collecting and the window was collected, I guess.

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
  • On 2012 May 09, at 14:20, Sean McBride wrote:

    > Are you using GC?

    No.  I never liked GC and decided not to use it – one of the few smart decisions I've made :))

    > Sounds a bit like something I saw the other day.  I close a window and "shortly" after invoke [NSApp windows] and lo and behold the window I closed is still there, for some definitions of "shortly".  If enough time passes, the garbage collector does some collecting and the window was collected, I guess.

    It turned out that inadvertently not releasing the window's window controller was causing the problem.
previous month may 2012 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today