aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPObjectAdditions.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-09-14 03:28:54 +0200
committerMax <post@wickenrode.com>2015-09-14 03:28:54 +0200
commitaa192cfe24c2866554d8785152e045f42233f287 (patch)
treef5aea5fc417b6e155d99918671ac5fce88473eb8 /Source/SPObjectAdditions.m
parent4707c32d7c349d41fefea6e97bb0f82facf9a353 (diff)
downloadsequelpro-aa192cfe24c2866554d8785152e045f42233f287.tar.gz
sequelpro-aa192cfe24c2866554d8785152e045f42233f287.tar.bz2
sequelpro-aa192cfe24c2866554d8785152e045f42233f287.zip
Even more debug code for _scrollViewDidChangeBounds
Since SPTableView and SPCopyTable seem to be the cause behind the majority of crashes let's take a closer look at them.
Diffstat (limited to 'Source/SPObjectAdditions.m')
-rw-r--r--Source/SPObjectAdditions.m43
1 files changed, 42 insertions, 1 deletions
diff --git a/Source/SPObjectAdditions.m b/Source/SPObjectAdditions.m
index 55e95437..9f51d652 100644
--- a/Source/SPObjectAdditions.m
+++ b/Source/SPObjectAdditions.m
@@ -30,6 +30,7 @@
#import <objc/runtime.h>
static NSMutableDictionary *gScrollViewListeners;
+static NSMutableDictionary *gScrollViewDealloc;
@implementation NSObject (SPObjectAdditions)
@@ -97,7 +98,10 @@ retryDescribe:
NSString *key = [NSString stringWithFormat:@"snd=%p,obs=%p",obj,self];
- [msg appendFormat:@"registration info for pair (%@):\n %@",key,[gScrollViewListeners objectForKey:key]];
+ [msg appendFormat:@"registration info for pair (%@):\n %@\n\n",key,[gScrollViewListeners objectForKey:key]];
+
+ NSString *deallocKey = [NSString stringWithFormat:@"=%p",self];
+ [msg appendFormat:@"self %@ was originally dealloc'ed at:\n %@",deallocKey,[gScrollViewDealloc objectForKey:deallocKey]];
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:msg userInfo:nil];
}
@@ -145,3 +149,40 @@ retryDescribe:
}
@end
+
+#import "SPTableView.h"
+
+@implementation SPTableView (SPScrollViewDebug)
+
++ (void)load
+{
+ static dispatch_once_t onceToken;
+
+ dispatch_once(&onceToken, ^{
+ gScrollViewDealloc = [[NSMutableDictionary alloc] init];
+
+ Class tableView = [self class];
+
+ SEL orig = @selector(dealloc);
+ SEL exch = @selector(sp_dealloc);
+
+ Method origM = class_getInstanceMethod(tableView, orig);
+ Method exchM = class_getInstanceMethod(tableView, exch);
+
+ method_exchangeImplementations(origM, exchM);
+ });
+}
+
+- (void)sp_dealloc
+{
+ NSString *key = [NSString stringWithFormat:@"=%p",self];
+ NSString *val = [NSString stringWithFormat:@"\ndealloc backtrace:\n%@\n\n",[NSThread callStackSymbols]];
+
+ [gScrollViewDealloc setObject:val forKey:key];
+
+ // not recursive! method is swizzled.
+ [self sp_dealloc];
+}
+
+
+@end