Skip to content

Commit

Permalink
Fix crash when using callback for local cfmessageports.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldoussoren committed Jun 7, 2021
1 parent 2f9b537 commit 4bc28cd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyobjc-framework-Cocoa/Lib/CoreFoundation/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def sel32or64(a, b):
"arguments": {
2: {
"callable": {
"retval": {"type": b"^{__CFData=}"},
"retval": {"type": b"^{__CFData=}", "already_cfretained": 1},
"arguments": {
0: {"type": b"^{__CFMessagePort=}"},
1: {"type": b"i"},
Expand Down
6 changes: 1 addition & 5 deletions pyobjc-framework-Cocoa/PyObjCTest/test_cfmessageport.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import CoreFoundation
import Foundation
import objc
from PyObjCTools.TestSupport import TestCase, min_os_level, expectedFailure

Expand Down Expand Up @@ -106,10 +105,7 @@ def callout(port, messageid, data, info):
err, data = CoreFoundation.CFMessagePortSendRequest(
cli,
99,
# XXX: Passing NSData is a workaround, for some reason
# passing a bytes object causes a crash at the end
# of the test (when the autorelease pool is drained).
Foundation.NSData.dataWithData_(b"message"),
b"message",
1.0,
1.0,
CoreFoundation.kCFRunLoopDefaultMode,
Expand Down
2 changes: 1 addition & 1 deletion pyobjc-framework-Cocoa/metadata/CoreFoundation.fwinfo
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,7 @@
}
],
"retval": {
"typestr": "^{__CFData=}"
"typestr": "^{__CFData=}", "already_cfretained": true
}
}
},
Expand Down

0 comments on commit 4bc28cd

Please sign in to comment.