Permalink
Browse files

Add some debug code for another crash that has been happening lately

  • Loading branch information...
dmoagx committed Oct 2, 2015
1 parent 9233309 commit f38ffcb95896ddf3774d30d0c64d8a57139b4ec6
@@ -313,7 +313,7 @@ - (id)queryString:(NSString *)theQueryString usingEncoding:(NSStringEncoding)the
theSqlstate = [self _stringForCString:mysql_sqlstate(mySQLConnection)];
// Prevent retries if the query was cancelled or not a connection error
if (lastQueryWasCancelled || ![SPMySQLConnection isErrorIDConnectionError:mysql_errno(mySQLConnection)]) {
if (lastQueryWasCancelled || ![SPMySQLConnection isErrorIDConnectionError:theErrorID]) {
break;
}
}
@@ -140,7 +140,7 @@ - (void)sp_addObserver:(id)notificationObserver selector:(SEL)notificationSelect
if([notificationObserver isKindOfClass:[NSView class]]) {
[val appendFormat:@" view info: id=%@, tag=%ld\n",[(NSView *)notificationObserver identifier], [(NSView *)notificationObserver tag]];
}
[val appendFormat:@"\nbacktrace:\n%@\n\n",[NSThread callStackSymbols]];
[val appendFormat:@"\nregistration backtrace:\n%@\n\n",[NSThread callStackSymbols]];
[gScrollViewListeners setObject:val forKey:key];
}
@@ -185,4 +185,40 @@ - (void)sp_dealloc
}
@end
#pragma mark -
@interface NSAlert (ApplePrivate)
- (IBAction)buttonPressed:(id)sender;
@end
@implementation NSAlert (SPAlertDebug)
+ (void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class alertClass = [self class];
SEL orig = @selector(buttonPressed:);
SEL exch = @selector(sp_buttonPressed:);
Method origM = class_getInstanceMethod(alertClass, orig);
Method exchM = class_getInstanceMethod(alertClass, exch);
method_exchangeImplementations(origM, exchM);
});
}
- (IBAction)sp_buttonPressed:(id)obj
{
NSLog(@"%s of %@ title=\n%@\ntext=\n%@",__func__,self,[self messageText],[self informativeText]);
[self sp_buttonPressed:obj];
}
@end
@@ -72,7 +72,7 @@ - (void) awakeFromNib
if ([NSTableView instancesRespondToSelector:@selector(awakeFromNib)]) {
[super awakeFromNib];
}
}
}
#pragma mark -

0 comments on commit f38ffcb

Please sign in to comment.