0

I have the following error in my code and am having difficulty finding out why.

-[NSRecursiveLock dealloc]: lock (<NSRecursiveLock: 0x1e559730> '(null)') deallocated while still in use
Break on _NSLockError() to debug.

So, I put a break point on NSLock Error. and here is the stack trace.

frame #0: 0x327e5288 Foundation`_NSLockError
frame #1: 0x327e6258 Foundation`-[NSRecursiveLock dealloc] + 108
frame #2: 0x327478ba ExternalAccessory`-[EAInputStream dealloc] + 122
frame #3: 0x32748420 ExternalAccessory`-[EAInputStream _streamEventTrigger] + 448
frame #4: 0x31ebf682 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #5: 0x31ebeee8 CoreFoundation`__CFRunLoopDoSources0 + 212
frame #6: 0x31ebdcb6 CoreFoundation`__CFRunLoopRun + 646
frame #7: 0x31e30ebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #8: 0x31e30d48 CoreFoundation`CFRunLoopRunInMode + 104
frame #9: 0x359e32ea GraphicsServices`GSEventRunModal + 74
frame #10: 0x33d46300 UIKit`UIApplicationMain + 1120
frame #11: 0x0009e93e Checkout`main(argc=1, argv=0x2fd6ad20) + 174 at main.mm:15
frame #12: 0x39fa1b20 libdyld.dylib`start + 4

NSRecursiveLock Deallocated is a similar post, where he solved his issue updating Xcode, but that didn't work for me =(. I get this error 90% of the time and 10% it works normally

my .h file in the VC in question...

#import <UIKit/UIKit.h>
#import "SignalR.h"
#import "ClientInterface.h"

@class POS;
@interface SignalRVC : UIViewController <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate>

@property (nonatomic, strong) NSString *stringFromScan;

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) NSMutableArray *data;
@property (weak, nonatomic) IBOutlet UILabel *errorLabel;

@property (strong, nonatomic, readwrite) SRHubConnection *connection;
@property (strong, nonatomic, readwrite) SRHubProxy *hub;
@property (strong, nonatomic) UIBarButtonItem *backBarButton;
@property (nonatomic, strong) NSMutableArray *registeredUpcs;
-(void)initConnection;

@end

my .m file gets through the viewDidLoad before crashing...

@interface SignalRVC ()
@property (strong,nonatomic) POS *myPOS;

@property (nonatomic, strong) NSString *qrLocation;
@property (nonatomic, strong) NSString *qrStation;
@property (nonatomic, strong) NSString *RPHost;
@property (nonatomic, strong) NSString *RPPort;

@property (nonatomic, strong) NSString *registeredUpc;
@property (nonatomic, strong) NSString *thumbnail;
@property (nonatomic, strong) NSString *productName;
@property (nonatomic, strong) NSString *color;
@property (nonatomic, strong) NSString *alu;
@property (nonatomic, strong) NSString *size;
@property (nonatomic, strong) NSString *upc;
@property (nonatomic, strong) NSDictionary *itemSpecs;

@property (weak, nonatomic) IBOutlet UIButton *checkoutButton;
@property (weak, nonatomic) IBOutlet UILabel *employeeLabel;

@end

@implementation SignalRVC

-(void)viewWillDisappear:(BOOL)animated{
    [_myPOS closeConnection];
    self.navigationController.toolbarHidden = YES;
}
-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = NO;

    NSData *dataFromQR = [self.stringFromScan dataUsingEncoding:NSUTF8StringEncoding];

    NSDictionary *jsonQR = [NSJSONSerialization JSONObjectWithData:dataFromQR options:NSJSONReadingMutableContainers error:nil];

    self.qrLocation = [jsonQR valueForKey:@"loc"];
    self.qrStation = [jsonQR valueForKey:@"id"];
    self.host = [jsonQR valueForKey:@"host"];
    self.port = [jsonQR valueForKey:@"port"];
}
- (void)viewDidLoad{
    [super viewDidLoad];

    //self.tableView.layer.cornerRadius = 10;

    if(!_myPOS){
        _myPOS = [[POS alloc] init];
    }
    _myPOS.mySignalRVC = self;

}

What is the stack trace telling me and what can I do to understand the problem better?

The only place that has the NSRecursiveLock class is in an AFJSONRequestOperation.m and a AFURLConnectionOperation.m file included as part of SignalR, but breakpoints never get triggered in those classes...

Thanks for any help.

Community
  • 1
  • 1
mattyd
  • 1,643
  • 2
  • 17
  • 26

1 Answers1

1

From your stack trace it looks like an object of type EAInputStream owns the lock object, and it's being deallocated while the lock is still in force. A quick google search shows that EAInputStream is a github framework. Did you add that, or did it come along with another framework you're using?

Duncan C
  • 128,072
  • 22
  • 173
  • 272
  • Looking into it and hopeful for a solution. Your comment helps me understand the stack better. =) – mattyd Jan 16 '14 at 00:45