diff --git a/AppDelegate.m b/AppDelegate.m index 4df540e..653281b 100755 --- a/AppDelegate.m +++ b/AppDelegate.m @@ -553,7 +553,11 @@ bail: if(YES != self.bottomViewController.isFiltered) { //get row - row = [self.bottomViewController.tableItems indexOfObject:item]; + @synchronized(self.bottomViewController.tableItems) + { + //get + row = [self.bottomViewController.tableItems indexOfObject:item]; + } } //filtering // ->grab row from filtered item @@ -627,7 +631,11 @@ bail: case DYLIBS_VIEW: //set table items - self.bottomViewController.tableItems = self.currentTask.dylibs; + @synchronized(self.bottomViewController.tableItems) + { + //set + self.bottomViewController.tableItems = self.currentTask.dylibs; + } //if there is none noItemsMsg = @"no dylibs found"; @@ -637,8 +645,12 @@ bail: //files case FILES_VIEW: - ///set table items - self.bottomViewController.tableItems = self.currentTask.files; + //set table items + @synchronized(self.bottomViewController.tableItems) + { + //set + self.bottomViewController.tableItems = self.currentTask.files; + } //if there is none noItemsMsg = @"no files found"; @@ -649,7 +661,11 @@ bail: case NETWORKING_VIEW: //set table items - self.bottomViewController.tableItems = self.currentTask.connections; + @synchronized(self.bottomViewController.tableItems) + { + //set + self.bottomViewController.tableItems = self.currentTask.connections; + } //if there is none noItemsMsg = @"no network connections found"; @@ -1435,7 +1451,11 @@ bail: self.noItemsLabel.hidden = YES; //unset existing items - self.bottomViewController.tableItems = nil; + @synchronized(self.bottomViewController.tableItems) + { + //unset + self.bottomViewController.tableItems = nil; + } //when in a background thread // ->perform UI stuff on main thread @@ -1875,7 +1895,11 @@ bail: (0 == self.taskTableController.filteredItems.count) ) { //unset bottom pane's items - self.bottomViewController.tableItems = nil; + @synchronized(self.bottomViewController.tableItems) + { + //unset + self.bottomViewController.tableItems = nil; + } //reset current task self.currentTask = nil; diff --git a/Consts.h b/Consts.h index a42b3ca..25a5b9b 100644 --- a/Consts.h +++ b/Consts.h @@ -316,7 +316,7 @@ //TODO: change back //search wait time (from app's launch) -#define SEARCH_WAIT_TIME 10 +#define SEARCH_WAIT_TIME 30 //pls wait (search) message #define PLS_WAIT_MESSAGE @"completing (initial) task/dylib/file enumeration please wait" diff --git a/Exception.m b/Exception.m index 3f9bce2..ea54d0e 100755 --- a/Exception.m +++ b/Exception.m @@ -78,7 +78,7 @@ void exceptionHandler(NSException *exception) syslog(LOG_ERR, "OBJECTIVE-SEE ERROR: %s", [errMsg UTF8String]); //err msg - syslog(LOG_ERR, "OBJECTIVE-SEE ERROR: %s", [[[NSThread callStackSymbols] description] UTF8String]); + syslog(LOG_ERR, "OBJECTIVE-SEE ERROR: %s/%s", [[exception.callStackSymbols description] UTF8String], [[exception.callStackReturnAddresses description] UTF8String]); //try print any objective-c objects in exception's 'reason' displayObject(exception); diff --git a/Filter.m b/Filter.m index bf14012..a00a13d 100644 --- a/Filter.m +++ b/Filter.m @@ -19,7 +19,6 @@ NSString * const BINARY_KEYWORDS[] = {@"#apple", @"#nonapple", @"#signed", @"#un @implementation Filter -//@synthesize fileFilters; @synthesize binaryFilters; //init @@ -69,24 +68,28 @@ NSString * const BINARY_KEYWORDS[] = {@"#apple", @"#nonapple", @"#signed", @"#un //matching connections NSMutableArray* matchingConnections = nil; - //alloc array for matching tasks + //alloc for matching tasks matchingTasks = [NSMutableArray array]; - //alloc array for matching dylibs + //alloc for matching dylibs matchingDylibs = [NSMutableArray array]; - //alloc dictionary for matching files + //alloc for matching files matchingFiles = [NSMutableArray array]; - //alloc dictionary for matching connections + //alloc for matching connections matchingConnections = [NSMutableArray array]; + //set flag isKeyword = [self isKeyword:filterText]; //filter all tasks [self filterTasks:filterText items:items results:matchingTasks pane:PANE_SEARCH]; + //add all to cumulative results + [results addObjectsFromArray:matchingTasks]; + //iterate over all tasks // ->for each, filter their dylib, files, etc for(Task* task in items.allValues) @@ -109,9 +112,28 @@ NSString * const BINARY_KEYWORDS[] = {@"#apple", @"#nonapple", @"#signed", @"#un [self filterFiles:filterText items:task.connections results:matchingConnections pane:PANE_SEARCH]; } - //remove duplicate dylibs - [results setArray:[[[NSSet setWithArray:results] allObjects] mutableCopy]]; + //remove dups dylibs + [matchingDylibs setArray:[[[NSSet setWithArray:matchingDylibs] allObjects] mutableCopy]]; + //add to cumulative search results + [results addObjectsFromArray:matchingDylibs]; + + //remove dups files + [matchingFiles setArray:[[[NSSet setWithArray:matchingFiles] allObjects] mutableCopy]]; + + //add to cumulative search results + [results addObjectsFromArray:matchingFiles]; + + //remove dups dylibs + [matchingConnections setArray:[[[NSSet setWithArray:matchingConnections] allObjects] mutableCopy]]; + + //add to cumulative search results + [results addObjectsFromArray:matchingConnections]; + + + + + //call back into search object to refresh it's UI and show results dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/Items/Binary.m b/Items/Binary.m index 9fbab4f..2ebfc5d 100644 --- a/Items/Binary.m +++ b/Items/Binary.m @@ -50,9 +50,7 @@ //determine if its on disk self.notFound = ![[NSFileManager defaultManager] fileExistsAtPath:self.path]; - - //grab attributes - //self.attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.path error:nil]; + } //bail @@ -303,6 +301,56 @@ bail: return prettyPrint; } +//override method +// ->hash +-(NSUInteger)hash +{ + return [self.path hash]; +} + +//override method +// ->equality check +-(BOOL)isEqual:(id)object +{ + //flag + BOOL objEqual = NO; + + //check self + if(self == object) + { + //match + objEqual = YES; + + //bail + goto bail; + } + + //check for type + if(YES != [object isKindOfClass:[Binary class]]) + { + //no match + objEqual = NO; + + //bail + goto bail; + } + + //do check + if(YES == [((Binary*)object).path isEqualToString:self.path]) + { + //happy + objEqual = YES; + + //bail + goto bail; + } + +//bail +bail: + + return objEqual; +} + //convert object to JSON string -(NSString*)toJSON { diff --git a/Items/Connection.m b/Items/Connection.m index ae3c957..e3cffb7 100644 --- a/Items/Connection.m +++ b/Items/Connection.m @@ -275,6 +275,58 @@ bail: return; } +//override method +// ->hash +-(NSUInteger)hash +{ + return [self.endpoints hash]; +} + +//override method +// ->equality check +-(BOOL)isEqual:(id)object +{ + //flag + BOOL objEqual = NO; + + //check self + if(self == object) + { + //match + objEqual = YES; + + //bail + goto bail; + } + + //check for type + if(YES != [object isKindOfClass:[Connection class]]) + { + //no match + objEqual = NO; + + //bail + goto bail; + } + + //do check + if(YES == [((Connection*)object).endpoints isEqualToString:self.endpoints]) + { + //happy + objEqual = YES; + + //bail + goto bail; + } + +//bail +bail: + + return objEqual; +} + + + //convert Connection object to a JSON string -(NSString*)toJSON { diff --git a/Items/File.m b/Items/File.m index 097f018..e1d07d6 100644 --- a/Items/File.m +++ b/Items/File.m @@ -92,6 +92,55 @@ bail: return; } +//override method +// ->hash +-(NSUInteger)hash +{ + return [self.path hash]; +} + +//override method +// ->equality check +-(BOOL)isEqual:(id)object +{ + //flag + BOOL objEqual = NO; + + //check self + if(self == object) + { + //match + objEqual = YES; + + //bail + goto bail; + } + + //check for type + if(YES != [object isKindOfClass:[File class]]) + { + //no match + objEqual = NO; + + //bail + goto bail; + } + + //do check + if(YES == [((File*)object).path isEqualToString:self.path]) + { + //happy + objEqual = YES; + + //bail + goto bail; + } + +//bail +bail: + + return objEqual; +} //convert object to JSON string -(NSString*)toJSON diff --git a/SearchWindowController.m b/SearchWindowController.m index 3eb839b..dfa6017 100644 --- a/SearchWindowController.m +++ b/SearchWindowController.m @@ -129,6 +129,15 @@ //reset search string [self.searchBox setStringValue:@""]; + //hide 'searching' overlay + self.overlayView.hidden = YES; + + //hide activity indicator + self.activityIndicator.hidden = YES; + + //hide activity indicator label + self.activityIndicatorLabel.hidden = YES; + //grab current time currentTime = [NSDate timeIntervalSinceReferenceDate]; @@ -213,6 +222,17 @@ //reload table [self.searchTable reloadData]; + //when nothing was found + // ->display label with this fact + if(0 == self.searchResults.count) + { + //set msg + self.activityIndicatorLabel.stringValue = @"nothing found"; + + //show + self.activityIndicatorLabel.hidden = NO; + } + return; }