Skip to content

Commit ec85d14

Browse files
committed
BookMacster 1.15.1, BookMacster 1.6.14
1 parent 9271ae1 commit ec85d14

7 files changed

+43
-17
lines changed

SSWebBrowsing.m

+7-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,13 @@ + (void)browseToURLString:(NSString*)urlString
159159
launchIdentifiers:NULL] ;
160160
}
161161
else {
162-
NSLog(@"Internal Error 324-6754. SSOpenURLInBrowser: could not create URL from %@", urlString) ;
162+
// Starting in BookMacster 1.15, we NSBeep() here instead of logging
163+
// Internal Error 324-6754. This happens if we are passed an invalid
164+
// URL such as a JavaScript bookmarklet, for example…
165+
// javascript:var%20wRWMain1=window.open('','RefWorksBookmark');d=document;i='AddToRWScript';if(d.getElementById(i))RWAddToRW1();else{s=d.createElement('script');s.type='text/javascript';s.src='http://www.refworks.com/refworks/include/addtorw.asp';s.id=i;d.getElementsByTagName('head')[0].appendChild(s);}void(0);
166+
if (NSApp) {
167+
NSBeep() ;
168+
}
163169
}
164170

165171
// openURLs

SSYDropboxIdler.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,15 @@ - (BOOL)waitForIdleDropboxTimeout:(NSTimeInterval)timeout
156156
NSInteger i ;
157157
[self appendProgress: @" Samples: "] ;
158158
for (i=0; i<COUNT_OF_SECONDARY_TESTS; i++) {
159-
// See if we can get three more in a row with CPU usage 0.25 percent or less
159+
// See if we can get three more in a row with CPU usage
160+
// is SECONDARY_TEST_THRESHOLD_AVERAGE_CPU_PERCENT
161+
// percent or less
160162
ok = [SSYOtherApper processPid:dropboxPid
161163
timeout:innerLoopPeriod // better be much less than this, to get lots of samples
162164
cpuPercent_p:&cpuPercent
163165
error_p:error_p] ;
164166
[self appendProgress:[NSString stringWithFormat:@"%0.1f%% ", cpuPercent]] ;
165-
if (cpuPercent > 0.25) {
167+
if (cpuPercent > SECONDARY_TEST_THRESHOLD_AVERAGE_CPU_PERCENT) {
166168
[self appendProgress:[NSString stringWithFormat:
167169
@"Threshold exceeded during %ld/%ld secondary tests.\nBack out to primary test.",
168170
(long)(i+1),

SSYMultiTextFieldCell.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ - (NSRect)drawAtLeftImage:(NSImage*)image
6969
NSRectFill(imageFrame);
7070
}
7171

72-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
72+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
7373
[image drawInRect:imageFrame
7474
fromRect:NSZeroRect
7575
operation:NSCompositePlusDarker

SSYOperation.h

+10
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,14 @@
154154
*/
155155
- (void)unlockLock ;
156156

157+
/*!
158+
@brief Unlocks the receiver's condition lock.
159+
160+
@details This method may be used in special cases where an error or other
161+
unexpected event might cause -prepareLock to be re-run before -unlockLock,
162+
when some operation is retried. If this method returns YES, you should skip
163+
-prepareLock.
164+
*/
165+
- (BOOL)lockIsBlocking ;
166+
157167
@end

SSYOperation.m

+18-10
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,18 @@ - (void)doSafely:(SEL)cmdNameC {
147147
- (void)prepareLock {
148148
// Normally, oldLock should be cleared at this point, if prior usage of
149149
// this lock is done.
150-
if ([self lock]) {
150+
if ([self lockIsBlocking]) {
151151
NSString* msg = nil ;
152-
if ([[self lock] condition] != SSY_OPERATION_CLEARED) {
153-
msg = [NSString stringWithFormat:@"Warning 209-8483 %@ lock=%@ info=%@",
154-
self,
155-
[self lock],
156-
[self info] ];
157-
NSLog(@"%@", msg) ;
152+
msg = [NSString stringWithFormat:@"Warning 209-8483 %@ lock=%@ info=%@",
153+
self,
154+
[self lock],
155+
[self info] ];
156+
NSLog(@"%@", msg) ;
158157
#if DEBUG
159-
NSAssert(NO, msg) ;
158+
NSAssert(NO, msg) ;
160159
#endif
161-
}
162160
}
163-
161+
164162
// I considered doing this:
165163
// [oldLock unlockWithCondition:SSY_OPERATION_CLEARED] ;
166164
// But am worried that it might raise an exception trying to unlock a lock on a
@@ -220,6 +218,16 @@ - (void)unlockLock {
220218
[lock release] ;
221219
}
222220

221+
- (BOOL)lockIsBlocking {
222+
BOOL answer = NO ;
223+
if ([self lock]) {
224+
if ([[self lock] condition] != SSY_OPERATION_CLEARED) {
225+
answer = YES ;
226+
}
227+
}
228+
229+
return answer ;
230+
}
223231

224232
- (void)main {
225233
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init] ;

SSYOtherApper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ __attribute__((visibility("default"))) @interface SSYOtherApper : NSObject {}
130130

131131
/*!
132132
@brief Returns the unix process ID (pid) of any process whose last path
133-
component matches a given process name, and whose which has the same unit
133+
component matches a given process name, and whose user id is the same
134134
user id as the current process, or 0 if no such process is running.
135135
136136
@details Starting with BookMacster 1.9, this method is now based on

SSYOtherApper.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,10 @@ + (NSString*)fullPathForAppWithBundleIdentifier:(NSString*)bundleIdentifier {
304304

305305
+ (NSArray*)pidsExecutablesFull:(BOOL)fullExecutablePath {
306306
// Run unix task "ps" and get results as an array, with each element containing process command and user
307-
// The invocation to be constructed is: ps -x[c]awww -o pid -o user -o command
307+
// The invocation to be constructed is: ps -xa[c]awww -o pid -o user -o command
308308
// -ww is required for long command path strings!!
309309
NSData* stdoutData ;
310-
NSString* options = fullExecutablePath ? @"-xww" : @"-xcww" ;
310+
NSString* options = fullExecutablePath ? @"-xaww" : @"-xacww" ;
311311
NSArray* args = [[NSArray alloc] initWithObjects:options, @"-o", @"pid=", @"-o", @"user=", @"-o", @"comm=", nil] ;
312312
// In args, the "=" say to omit the column headers
313313
[SSYShellTasker doShellTaskCommand:@"/bin/ps"

0 commit comments

Comments
 (0)