-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
whenWillCloseDo: block is evaluated twice when closing a window #1547
Comments
I extracted
|
Now this is not working because the the |
I need to discuss this, I am not sure we need deleteDiscardingChanges (and even delete is not recommended in spec, there is a reason why is on private method). |
Ok fine by me. We struggled a lot on this bug and discussed also with @tesonep |
@estebanlm This issue cannot be closed. The original issue is not fixed, as you can see in this video: Screen.Recording.2024-10-18.at.15.10.27.mov |
Context: Pharo 12.
Consider this code:
Be aware that a
SpWindowWillClose
announcement has a default of allowing a window to close (seeSpWindowWillClose>>#initialize
). That is why the code above does not sendannouncement allowClose
.Here is the reason:
The method
closeBoxHit
sendsclose
:close
sends the announcement:That will trigger the
whenWillCloseDo:
block in the code snippet.SpWindow>>close
does a super send, becauseself announceWillClose
evaluates totrue
(the user clicked "Yes").The method in the superclass is:
and
delete
is:It does super send on the last line:
The last line sends
deleteDiscardingChanges
:This method announces the window close again, as
SpWindow>>close
already did. That results in opening the confirmation dialog again.The text was updated successfully, but these errors were encountered: