Merge pull request #3158 from daboe01/fixed-CPDocument-sends-windowWillClose-message-twice

fixed: CPDocument sends windowWillClose: message twice
This commit is contained in:
daboe01 authored and GitHub committed 2025-12-26 10:44:27 +01:00
commit fefa603b45
1 file changed
+5 -2
+5 -2
View File
@@ -871,10 +871,13 @@ var CPDocumentUntitledCount = 0;
{
var theDelegate = context.delegate;
if (aDocument === self && shouldClose)
// Only close the document explicitly if there is NO delegate to handle the action.
// If a delegate exists (e.g., the CPWindow), it is responsible for performing the close
// upon receiving the callback below. Calling [self close] here would cause a double-close.
if (aDocument === self && shouldClose && theDelegate == nil)
[self close];
if (theDelegate != null)
if (theDelegate)
theDelegate.isa.objj_msgSend3(theDelegate, context.selector, aDocument, shouldClose, context.context);
}