App window count steadily increases if user exits versions browser while window controllers are still loading

Originator:tchamblee
Number:rdar://20351088 Date Originated:03/30/2015
Status:Open Resolved:
Product:OS X SDK Product Version:10.10
Classification: Reproducible:Sometimes
 
Summary:
If a user enters the document versions browser, mouses over several versions in the versions guide on the right hand side of the screen to cause multiple versions of a document to load simultaneously, and then taps the 'Done' button prior to all windows being loaded - the windows (and associated documents) are never closed and remain open until the app is closed.

Steps to Reproduce:
Please see sample project at https://github.com/tchamblee/DocumentSandbox.

1.  Launch the sample application.  It will create a document and save several versions (the reproduction is dependent on several versions being present.)
2.  Launch the document versions browser (File - Revert To - Browse All Versions).
3.  Swipe the mouse cursor down the versions guide on the right hand side of the screen, hovering over each version.  This will cause multiple documents to load simultaneously, and multiple window controllers to load simultaneously.
4.  Before all of the windows are done loading (the sample project blocks the main thread intentionally - simulating a non-trivial amount of time in which the main thread can be blocked due to window UI creation), click the 'Done' button to exit the versions browser.
5.  Notice that the app's window count will steadily increase, as windows that were not loaded when the user tapped 'Done' appear to hang open indefinitely. (See the NSLog statements being printed in the sample project.)

Reproduction may take multiple attempts.  The 'Done' button must be clicked soon after you have swiped the mouse cursor down all of the documents in the versions guide on the right hand side of the screen, such that all of the windows don't have time to complete their loading process.

Expected Results:
I expect that the app would have the same number of windows upon exiting the versions browser as it did when entering the versions browser.

Actual Results:
The app's window count steadily increases, as windows are left hanging open until the app terminates.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!