GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [[ Bug 20886 ]] Fix crash when class omitted in objc binding · livecode/livecode@6acc827

This repository was archived by the owner on Aug 31, 2021. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs/lcb/notes
    • 20886.md
  • libscript/src
    • script-instance.cpp
  • tests/lcb/vm
    • interop-objc.lcb
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/lcb/notes/20886.md‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# [20886] Fix crash when class is omitted in obj-c binding string
Collapse file

‎libscript/src/script-instance.cpp‎

Copy file name to clipboardExpand all lines: libscript/src/script-instance.cpp
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -978,12 +978,6 @@ __MCScriptResolveForeignFunctionBindingForObjC(MCScriptInstanceRef p_instance,
978978
{
979979
return false;
980980
}
981-
982-
MCAutoStringRefAsUTF8String t_class_cstring;
983-
if (!t_class_cstring.Lock(*t_class))
984-
{
985-
return false;
986-
}
987981

988982
bool t_valid = true;
989983
bool t_is_dynamic = MCStringIsEmpty(*t_class);
@@ -1002,6 +996,12 @@ __MCScriptResolveForeignFunctionBindingForObjC(MCScriptInstanceRef p_instance,
1002996
}
1003997
else
1004998
{
999+
MCAutoStringRefAsUTF8String t_class_cstring;
1000+
if (!t_class_cstring.Lock(*t_class))
1001+
{
1002+
return false;
1003+
}
1004+
10051005
t_objc_class = objc_getClass(*t_class_cstring);
10061006
if (t_objc_class == nullptr)
10071007
{
Collapse file

‎tests/lcb/vm/interop-objc.lcb‎

Copy file name to clipboardExpand all lines: tests/lcb/vm/interop-objc.lcb
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,21 @@ public handler TestDynamicInstanceMethodBinding()
221221
end unsafe
222222
end handler
223223

224+
foreign handler DynamicGetIntNoClass(in pObject as ObjcId) returns CInt \
225+
binds to "objc:-intValue"
226+
227+
public handler TestDynamicInstanceMethodNoClassCrash()
228+
if not the operating system is in ["mac", "ios"] then
229+
skip test "obj-c dynamic instance method binding no class crash" \
230+
because "not implemented on" && the operating system
231+
return
232+
end if
233+
234+
unsafe
235+
test "dynamic method binds" when DynamicGetIntNoClass is not nothing
236+
end unsafe
237+
end handler
238+
224239
foreign handler DynamicAlloc() returns ObjcRetainedId \
225240
binds to "objc:.+alloc"
226241

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.