mirror of
https://github.com/objective-see/TaskExplorer.git
synced 2026-03-22 07:02:39 +00:00
wrapped access to bottomViewController's 'tableItem' variable in a @sync block (was causing mutation error!)
changed exception handling code to use exception.callStackSymbols, which should give actual backtrace of exception finalized global search, to filter out duplicate dylibs, files, etc added 'nothing found' message to global search
This commit is contained in:
+31
-7
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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(), ^{
|
||||
|
||||
|
||||
+51
-3
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user