Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add ARC bug test

  • Loading branch information...
commit fee2fa26dc4fefca9a6245ebce3c2b712a779a16 1 parent 91d51b5
@tmurakam authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 Classes/AppDelegate.m
View
25 Classes/AppDelegate.m
@@ -19,6 +19,7 @@
#import "DropboxSecret.h"
@interface AppDelegate() <CrashReportSenderDelegate>
+- (void)tryArcBug;
- (void)setupGoogleAnalytics;
- (void)delayedLaunchProcess:(NSTimer *)timer;
@end
@@ -53,6 +54,28 @@ - (id)init {
return self;
}
+- (void)tryArcBug
+{
+ UIButton *b, *b1, *b2;
+
+ for (int i = 0; i < 2; i++) {
+ b = [UIButton buttonWithType:UIButtonTypeRoundedRect];
+ if (i == 0) {
+ b1 = b;
+ } else {
+ b2 = b;
+ }
+ }
+ b = nil;
+
+ int rc1 = CFGetRetainCount((__bridge void *)b1);
+ int rc2 = CFGetRetainCount((__bridge void *)b2);
+
+ if (rc1 != 2 || rc2 != 2) {
+ NSLog(@"Oops! It may be ARC + optimization bug! rc1 = %d, rc2 = %d both must be 2!", rc1, rc2);
+ }
+}
+
//
// 開始処理
//
@@ -61,6 +84,8 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application
NSLog(@"applicationDidFinishLaunching");
_application = application;
+ [self tryArcBug];
+
CrashReportSender *csr = [CrashReportSender sharedCrashReportSender];
sIsPrevCrashed = [csr hasPendingCrashReport];
Please sign in to comment.
Something went wrong with that request. Please try again.