bugGNUstep - Bugs: bug #34789, ...


You are not allowed to post comments on this tracker with your current authentication level.

bug #34789: performSelector:withObject:afterDelay not working while a sheet is displayed

Submitted by:  julian <julian_>
Submitted on:  Wed 09 Nov 2011 10:30:39 PM UTC  
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Mon 14 Nov 2011 02:31:03 PM UTC, comment #4:


julian <julian_>
Mon 14 Nov 2011 02:14:16 PM UTC, comment #3:

sorry for forgetting to attach the example - of course i deleted it by now and had to recreate it - attached.

i see you are right that it isn't supposed to work - unless there is somehow more to it the documentation would indicate that the main run loop is paused.

however, this is not what is happening on Mac OS X.

the main run loop is paused when something completely modal is done like
[NSApplication runModalForWindow:], you can't interact with any other windows of the app anymore and the main runloop is paused.

other methods like
that present a window that is modal just for a single window don't seem to block the main run loop and also let you interact with other windows, just not the blocked one.

its a bit confusing that all these methods have modalForWindow: in their name while in the first case this is the window that is presented modally, blocking everything else, while for the methods in the second class, the window parameter is not the presented window, but rather the only window that will be blocked.

anyway, since this is not completely clear from the documentation, i could understand not wanting to "fix" anything here.

will file a bug at apple about the documentation not matching reality now.

(file #24370)

julian <julian_>
Sun 13 Nov 2011 07:58:04 PM UTC, comment #2:

Actually you did not attach any example code to this bug report. That way I can only speculate about that actual code.

If your code is using the NSApplication method beginSheet:modalForWindow:... then the behaviour you get is what would be expected from AppKit in 10.5.8. Here the documentation reads:

"It also does not perform any tasks (such as firing timers) that are not associated with the modal run loop."

If you need your action method to work for sheets you should use the method performSelector:withObject:afterDelay:inModes: and supply the NSModalPanelRunLoopMode in modes as well.

Fred Kiefer <FredKiefer>
Project Member
Thu 10 Nov 2011 02:11:13 PM UTC, comment #1:

>this bug is kinda a problem since it prevents me from working around other problems (which i can't reproduce in a minimal sample at the moment).

ok no need to rush, i found another workaround.

julian <julian_>
Wed 09 Nov 2011 10:30:39 PM UTC, original submission:

hey there

attached is a very simple test application:

clicking on the button "sheet" opens a sheet, with two buttons, "close" and "perform"

clicking the button perform does the following:

[self performSelector:@selector(test) withObject:nil afterDelay:0.5];

however, the method test is not called after half an second (it logs to stdout so that can be observed)....it is called only after the sheet is closed with the close button.

notes of interest:
[self performSelector:] works fine, its the version with delay thats bugged inside the sheet
i tried about 10 times and one time the method test was not called at all after the sheet closed, the invocation was "forgotten completely" instead of just delayed.

this bug is kinda a problem since it prevents me from working around other problems (which i can't reproduce in a minimal sample at the moment).

julian <julian_>


Attached Files
file #24370:  gnustepbug-perform.zip added by julian_ (120KiB - application/zip)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by julian_ (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-11-14 julian_ Attached File- => Added gnustepbug-perform.zip, #24370

    Back to the top

    Powered by Savane 3.3