aboutsummaryrefslogtreecommitdiffstats
path: root/Source
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
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')
-rw-r--r--Source/SPObjectAdditions.m43
-rw-r--r--Source/SPTableView.m5
2 files changed, 47 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
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index 72535038..7a1c01c1 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -61,6 +61,11 @@
return self;
}
+- (void)dealloc
+{
+ [super dealloc];
+}
+
- (void) awakeFromNib
{
[super setDoubleAction:@selector(_doubleClickAction)];