Closed ichizok closed 8 years ago
Quick-fix #75.
1) addObserver doesn't retain observer object.
addObserver
Thus autoreleasing makes observer release instantly, and dangling pointer causes crash.
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/#//apple_ref/occ/instm/NSObject/addObserver:forKeyPath:options:context:
Neither the receiver, nor anObserver, are retained.
2) Observation of com.apple.keyboard.modifiermapping is ineffective, as the comment goes.
com.apple.keyboard.modifiermapping
To detect changes, perhaps we can observe com.apple.keyboard.modifiermapping.${VendorID}-${ProductID}-0 of keyboard.
com.apple.keyboard.modifiermapping.${VendorID}-${ProductID}-0
Quick-fix #75.
1)
addObserver
doesn't retain observer object.Thus autoreleasing makes observer release instantly, and dangling pointer causes crash.
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/#//apple_ref/occ/instm/NSObject/addObserver:forKeyPath:options:context:
2) Observation of
com.apple.keyboard.modifiermapping
is ineffective, as the comment goes.To detect changes, perhaps we can observe
com.apple.keyboard.modifiermapping.${VendorID}-${ProductID}-0
of keyboard.