alexrozanski / PXSourceList

Source List control for the Mac
Other
638 stars 76 forks source link

sourceListDeleteKeyPressedOnRows: called twice #43

Closed jdrukman closed 10 years ago

jdrukman commented 10 years ago

Just what it says. Whenever I press the delete key, that method fires twice with an identical notification. I'm sure I'm doing something wrong, but I don't know where to start looking. Help!

alexrozanski commented 10 years ago

Are you using PXSourceList > 2.0.0? I've got a hunch for what might be wrong:

In PXSourceListDelegateDataSourceProxy.m, try changing the name passed to -removeObserver:name:object: on line 73 at the current version (see https://github.com/Perspx/PXSourceList/blob/master/PXSourceList/Internal/PXSourceListDelegateDataSourceProxy.m#L73 ) from self to self.sourceList.

Let me know if this fixes the problem.

jdrukman commented 10 years ago

Yes, that fixed it! Thank you!

alexrozanski commented 10 years ago

Great, thanks!

The issue was that setting the delegate twice wasn't unregistering the previous delegate from receiving those notifications which is why the method was getting called twice.

I'm guessing you might be setting the delegate in IB and then in your -awakeFromNib or similar as well. Whilst this is slightly inefficient, it shouldn't cause problems like this!

I'll get a release of PXSourceList out to fix this!