diff options
author | Sam Bingner <sam@bingner.com> | 2020-08-20 11:15:15 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2020-08-20 11:15:15 -1000 |
commit | 39b1f27c909aee67526c4a7dbc9c8f1cbec98402 (patch) | |
tree | d2c79b157ee4e3365facc95ae0a9d38f940a5752 /Tweak.xm | |
parent | f280d3d5149b57ae58e35feb18351ed62a8fa7ec (diff) |
Clang still refuses to play nice, so just ivars for this another way
Diffstat (limited to 'Tweak.xm')
-rw-r--r-- | Tweak.xm | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -29,10 +29,10 @@ // Because compiler is optimizing out checks for dereferenced null pointers template <typename Type_> -static inline Type_ &MYHookIvar(id self, const char *name) { +static void MYHookIvar(id self, const char *name, Type_ *ivar_p) { Ivar ivar(class_getInstanceVariable(object_getClass(self), name)); void *value = ivar == NULL ? NULL : *reinterpret_cast<void **>(reinterpret_cast<char *>(self) + ivar_getOffset(ivar)); - return *(reinterpret_cast<Type_ *>(&value)); + *ivar_p = reinterpret_cast<Type_>(value); } @@ -334,8 +334,10 @@ static void AlertIfNeeded() { %hook SBUIController - (id) init { if ((self = %orig()) != nil) { - UIView *_contentLayer = MYHookIvar<UIView *>(self, "_contentLayer"); - UIView *_contentView = MYHookIvar<UIView *>(self, "_contentView"); + UIView *_contentLayer; + MYHookIvar<UIView *>(self, "_contentLayer", &_contentLayer); + UIView *_contentView; + MYHookIvar<UIView *>(self, "_contentView", &_contentView); UIView *layer; if (_contentLayer != NULL) |