Skip to content

Commit 1a7240b

Browse files
GeoffroyAubeyTautvydasZilys
authored andcommitted
Adopt correct objc call API
Signed-off-by: Tautvydas Žilys <[email protected]>
1 parent 8a23ef6 commit 1a7240b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

mono/utils/mono-threads-mach-helper.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ mono_dead_letter_dealloc (id self, SEL _cmd)
5757
{
5858
struct objc_super super;
5959
super.receiver = self;
60+
#if !defined(__cplusplus) && !__OBJC2__
6061
super.class = nsobject;
61-
objc_msgSendSuper (&super, dealloc);
62+
#else
63+
super.super_class = nsobject;
64+
#endif
65+
void (*objc_msgSendSuper_op)(struct objc_super *, SEL) = (void (*)(struct objc_super *, SEL)) objc_msgSendSuper;
66+
objc_msgSendSuper_op (&super, dealloc);
6267

6368
mono_thread_info_detach ();
6469
}
@@ -75,19 +80,20 @@ mono_threads_install_dead_letter (void)
7580
* It doesn't hurt on other architectures either, so no need to #ifdef it only for ARM64.
7681
*/
7782

83+
id (*id_objc_msgSend)(id, SEL) = (id (*)(id, SEL)) objc_msgSend;
7884
id (*id_objc_msgSend_id)(id, SEL, id) = (id (*)(id, SEL, id)) objc_msgSend;
7985
void (*objc_msgSend_id_id)(id, SEL, id, id) = (void (*)(id, SEL, id, id)) objc_msgSend;
8086

81-
cur = objc_msgSend ((id)nsthread, currentThread);
87+
cur = id_objc_msgSend ((id)nsthread, currentThread);
8288
if (!cur)
8389
return;
84-
dict = objc_msgSend (cur, threadDictionary);
90+
dict = id_objc_msgSend (cur, threadDictionary);
8591
if (dict && id_objc_msgSend_id (dict, objectForKey, mono_dead_letter_key) == nil) {
86-
id value = objc_msgSend (objc_msgSend ((id)mono_dead_letter_class, alloc), init);
92+
id value = id_objc_msgSend (id_objc_msgSend ((id)mono_dead_letter_class, alloc), init);
8793

8894
objc_msgSend_id_id (dict, setObjectForKey, value, mono_dead_letter_key);
8995

90-
objc_msgSend (value, release);
96+
id_objc_msgSend (value, release);
9197
}
9298
}
9399

@@ -119,13 +125,15 @@ mono_threads_init_dead_letter (void)
119125
class_addMethod (mono_dead_letter_class, dealloc, (IMP)mono_dead_letter_dealloc, "v@:");
120126
objc_registerClassPair (mono_dead_letter_class);
121127

128+
id (*id_objc_msgSend)(id, SEL) = (id (*)(id, SEL)) objc_msgSend;
129+
122130
// create the dict key
123-
pool = objc_msgSend (objc_msgSend (nsautoreleasepool, alloc), init);
131+
pool = id_objc_msgSend (id_objc_msgSend (nsautoreleasepool, alloc), init);
124132

125133
id (*objc_msgSend_char)(id, SEL, const char*) = (id (*)(id, SEL, const char*)) objc_msgSend;
126134
mono_dead_letter_key = objc_msgSend_char (nsstring, stringWithUTF8String, "mono-dead-letter");
127135

128-
objc_msgSend (mono_dead_letter_key, retain);
129-
objc_msgSend (pool, release);
136+
id_objc_msgSend (mono_dead_letter_key, retain);
137+
id_objc_msgSend (pool, release);
130138
}
131139
#endif

0 commit comments

Comments
 (0)