Przeglądaj źródła

Fix #329

Whoops. Thanks @DGh0st

Also fix a build issue, a typo in some macros
Tanner Bennett 6 lat temu
rodzic
commit
0803b46f9d

+ 4 - 4
Classes/ObjectExplorers/Controllers/FLEXViewExplorerViewController.m

@@ -164,14 +164,14 @@ typedef NS_ENUM(NSUInteger, FLEXViewExplorerRow) {
 
 #pragma mark - Runtime Adjustment
 
-#define PropertyKey(suffix) kFLEXPropertyAttributeKey##suffix : @""
-#define PropertyKeyGetter(getter) kFLEXPropertyAttributeKeyCustomGetter : NSStringFromSelector(@selector(getter))
-#define PropertyKeySetter(setter) kFLEXPropertyAttributeKeyCustomSetter : NSStringFromSelector(@selector(setter))
+#define PropertyKey(suffix) kFLEXUtilityAttribute##suffix : @""
+#define PropertyKeyGetter(getter) kFLEXUtilityAttributeCustomGetter : NSStringFromSelector(@selector(getter))
+#define PropertyKeySetter(setter) kFLEXUtilityAttributeCustomSetter : NSStringFromSelector(@selector(setter))
 
 #define FLEXRuntimeUtilityTryAddProperty(iOS_atLeast, name, cls, type, ...) ({ \
     if (@available(iOS iOS_atLeast, *)) { \
         NSMutableDictionary *attrs = [NSMutableDictionary dictionaryWithDictionary:@{ \
-            kFLEXPropertyAttributeKeyTypeEncoding : @(type), \
+            kFLEXUtilityAttributeTypeEncoding : @(type), \
             __VA_ARGS__ \
         }]; \
         [FLEXRuntimeUtility \

+ 4 - 3
Classes/Utility/FLEXRuntimeUtility.m

@@ -434,7 +434,8 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     //
     // returnType = method_getTypeEncoding(class_getInstanceMethod([object class], selector));
     NSMethodSignature *methodSignature = [object methodSignatureForSelector:selector];
-    if (!methodSignature.methodReturnLength) {
+    if (!methodSignature.methodReturnLength &&
+        methodSignature.methodReturnType[0] != FLEXTypeEncodingVoid) {
         return nil;
     }
 
@@ -493,10 +494,9 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
                     NSGetSizeAndAlignment(typeEncodingCString, &bufferSize, NULL);
 
                     if (bufferSize > 0) {
-                        void *buffer = calloc(bufferSize, 1);
+                        void *buffer = alloca(bufferSize);
                         [argumentValue getValue:buffer];
                         [invocation setArgument:buffer atIndex:argumentIndex];
-                        free(buffer);
                     }
                 } @catch (NSException *exception) { }
             }
@@ -506,6 +506,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     // Try to invoke the invocation but guard against an exception being thrown.
     id returnObject = nil;
     @try {
+        [invocation invoke];
 
         // Retrieve the return value and box if necessary.
         const char *returnType = methodSignature.methodReturnType;