ronaldoussoren / pyobjc

The Python <-> Objective-C Bridge with bindings for macOS frameworks
https://pyobjc.readthedocs.io
563 stars 47 forks source link

NSIndexSet.alloc().initWithIndex_ segfaults #625

Closed Sbte closed 3 weeks ago

Sbte commented 1 month ago

Describe the bug

The following code segfaults:

from Foundation import NSIndexSet
s = NSIndexSet.alloc().initWithIndex_(0)

This is used in array_property so using array_property also causes segfaults.

Note that NSIndexSet.indexSetWithIndex_(0) works fine.

Platform information

rndblnch commented 1 month ago

this looks very similar to the old #271

rndblnch commented 1 month ago

the fix for #271 is specific to NSData, it can be found in this commit: bf601d4

ronaldoussoren commented 1 month ago

Thanks.

I'm currently travelling and will look into this when I'm back home.

ronaldoussoren commented 3 weeks ago

@rndblnch: #271 is relevant, I'm tweaking that workaround to be more general. Thanks for the tip, that made finding a workaround a lot easier.

rndblnch commented 2 weeks ago

@rndblnch: #271 is relevant, I'm tweaking that workaround to be more general. Thanks for the tip, that made finding a workaround a lot easier.

glad it helped, it's pure chance that I saw this one while reporting something else, and it rang a bell. after some digging I found the bug I reported 5 years ago … thanks again for your work.

Sbte commented 2 weeks ago

That indeed seems to have fixed the issue, also when using array_property. Thanks a lot!