From 70241eaff8f59032c42ad09a1c06570982fd58c8 Mon Sep 17 00:00:00 2001 From: Ke Ming Jiang <389185764@qq.com> Date: Wed, 3 Feb 2021 16:34:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=94=B1=E4=BA=8Eget?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=B8=AD=E7=9A=84autorelease=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E5=B4=A9=E6=BA=83=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OCRunner/RunEnv/MFValue.h | 2 +- OCRunner/RunEnv/MFValue.m | 4 ++-- OCRunner/RunnerClasses+Reverse.m | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OCRunner/RunEnv/MFValue.h b/OCRunner/RunEnv/MFValue.h index d2e62a8..3bb4cc0 100644 --- a/OCRunner/RunEnv/MFValue.h +++ b/OCRunner/RunEnv/MFValue.h @@ -403,7 +403,7 @@ extern BOOL MFStatementResultTypeIsReturn(MFStatementResultType type); @property (assign, nonatomic, readonly) double doubleValue; @property (nonatomic, nullable, readonly) id objectValue; -@property (nonatomic, nullable, readonly) Class classValue; +@property (nonatomic, nullable, readonly) void *classValue; @property (nonatomic, nullable, readonly) SEL selValue; @property (nonatomic, nullable, readonly) char *cStringValue; diff --git a/OCRunner/RunEnv/MFValue.m b/OCRunner/RunEnv/MFValue.m index 9f4d16e..63a5865 100644 --- a/OCRunner/RunEnv/MFValue.m +++ b/OCRunner/RunEnv/MFValue.m @@ -630,8 +630,8 @@ - (double)doubleValue{ - (id)objectValue{ return *(__strong id *)self.pointer; } -- (Class)classValue{ - return *(Class *)self.pointer; +- (void *)classValue{ + return *(void **)self.pointer; } - (SEL)selValue{ return *(SEL *)self.pointer; diff --git a/OCRunner/RunnerClasses+Reverse.m b/OCRunner/RunnerClasses+Reverse.m index f2b18ff..cfc749c 100644 --- a/OCRunner/RunnerClasses+Reverse.m +++ b/OCRunner/RunnerClasses+Reverse.m @@ -52,8 +52,6 @@ - (void)deallocffiReusltForKey:(NSValue *)key{ } } - (void)reverse{ - MFValue *classValue = [[MFScopeChain topScope] recursiveGetValueWithIdentifier:self.className]; - Class classVar = classValue.classValue; Class class = NSClassFromString(self.className); // Reverse时,释放ffi_closure和ffi_type for (ORMethodImplementation *imp in self.methods) { @@ -77,7 +75,7 @@ - (void)reverse{ [[MFMethodMapTable shareInstance] removeMethodsForClass:class]; [[MFPropertyMapTable shareInstance] removePropertiesForClass:class]; - // FIXME: 真机下,调用后崩溃的问题 + Class classVar = [[MFScopeChain topScope] recursiveGetValueWithIdentifier:self.className].classValue; if (classVar != nil && classVar == class) { objc_disposeClassPair(classVar); }