bugGNUstep - Bugs: bug #34789, ...


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

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

Add a New Comment Rich Markup

Jump to the original submission

Sun 01 Nov 2020 12:08:17 PM UTC, comment #8: 

Oh wow! Gotcha. GC

Gregory John Casamento <gcasa>
Group administrator
Sun 01 Nov 2020 11:58:11 AM UTC, comment #7: 

In the mean time Apple has changed the documentation of their beginSheet: methods to

"This method displays the sheet modally on the specified window and returns control to the caller. Most events targeted at docWindow are prohibited while the sheet is displayed but the app’s main run loop runs normally otherwise."

The problem for GNUstep is that we implement sheets via the already existing runModal: code. A complete rewrite would be required here. Patches welcome.

Fred Kiefer <FredKiefer>
Group Member
Sun 01 Nov 2020 10:42:16 AM UTC, comment #6: 

Fred, could you possibly take a look at this?

Gregory John Casamento <gcasa>
Group administrator
Sat 31 Oct 2020 10:21:17 AM UTC, comment #5: 

This still happens.  Just confirmed.

Gregory John Casamento <gcasa>
Group administrator
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>
Group 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_>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

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 gcasa (Posted a comment)
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by julian_ (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

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

    Back to the top

    Powered by Savane 3.13-599c.
    Corresponding source code