File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import "C"
1111import (
1212 "math"
1313 "reflect"
14+ "strings"
1415 "unsafe"
1516)
1617
@@ -142,7 +143,17 @@ func goMethodCallEntryPoint(p uintptr) uintptr {
142143 sel := stringFromSelector (unsafe .Pointer (fetcher .Int ()))
143144
144145 clsName := object {ptr : getObjectClass (obj ).Pointer ()}.className ()
146+ // Sometimes newer versions of macOS dynamically create a "NSKVONotifying_"
147+ // prefixed subclass, which we won't have registered in classMap. However,
148+ // since it's a subclass, we can probably get away with looking up the class
149+ // that was inherited from based on the name part after the prefix.
150+ if strings .HasPrefix (clsName , "NSKVONotifying_" ) {
151+ clsName = strings .Replace (clsName , "NSKVONotifying_" , "" , 1 )
152+ }
145153 clsInfo := classMap [clsName ]
154+ if clsInfo .typ == nil {
155+ panic ("unable to find registered class: " + clsName )
156+ }
146157 method := clsInfo .MethodForSelector (sel )
147158
148159 // Check if we have an internal pointer set for this object.
Original file line number Diff line number Diff line change @@ -141,7 +141,17 @@ func goMethodCallEntryPoint(p uintptr) uintptr {
141141 sel := stringFromSelector (unsafe .Pointer (fetcher .Int ()))
142142
143143 clsName := object {ptr : getObjectClass (obj ).Pointer ()}.className ()
144+ // Sometimes newer versions of macOS dynamically create a "NSKVONotifying_"
145+ // prefixed subclass, which we won't have registered in classMap. However,
146+ // since it's a subclass, we can probably get away with looking up the class
147+ // that was inherited from based on the name part after the prefix.
148+ if strings .HasPrefix (clsName , "NSKVONotifying_" ) {
149+ clsName = strings .Replace (clsName , "NSKVONotifying_" , "" , 1 )
150+ }
144151 clsInfo := classMap [clsName ]
152+ if clsInfo .typ == nil {
153+ panic ("unable to find registered class: " + clsName )
154+ }
145155 method := clsInfo .MethodForSelector (sel )
146156
147157 // Check if we have an internal pointer set for this object.
You can’t perform that action at this time.
0 commit comments