MacOS – Can ThreadSafe errors for ScriptingAdditions be eliminated without deleting the addition files

consolelogsmacospages

I've the following errors in my system log when running e.g. Pages:

Aug  4 19:06:50 Pages[9751]: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/Library/ScriptingAdditions/MySpeed.osax"
Aug  4 19:06:50 Pages[9751]: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/Library/ScriptingAdditions/SIMBL.osax"

What is the cause of that and how do I fix that?

Best Answer

As workaround, InjectEventHandler handler can be removed or commented out from Info.plist from the files:

/Library/ScriptingAdditions/SIMBL.osax/Contents/Info.plist
/Library/ScriptingAdditions/MySpeed.osax/Contents/Info.plist

Source: https://code.google.com/p/simbl/issues/detail?id=7

In example:

--- a/Info.plist
+++ b/Info.plist
@@ -37,8 +37,6 @@
                <key>Context</key>
                <string>Process</string>
            </dict>
-           <key>SIMeleop</key>
-           <string>InjectEventHandler</string>
        </dict>
    </dict>
 </dict>

Or you can also try to set ThreadSafe to true: E.g.

<key>OSAXHandlers</key>
<dict>
    <key>Events</key>
    <dict>
        <key>sysodlog</key>
        <dict>
            <key>Handler</key>
            <string>DisplayDialogEventHandler</string>
            <key>ThreadSafe</key>
            <true/>
            <key>Context</key>
            <string>Process</string>
        </dict> 
...

Handler dictionary keys:

ThreadSafe - A boolean; is the handler thread-safe? (Event handlers only.)

ThreadSafe OSA and AppleScript in Mac OS X v10.6 are thread-safe. If a script is executed on a background thread and invokes an event handler that is not thread-safe, it will be called on the main thread, which is slower than directly invoking it on the calling thread and may reduce application responsiveness to user input. Ideally, all handlers should be thread-safe. Some inherently cannot be; for example, almost anything that displays UI must be executed on the main thread. You are encouraged to either verify that your event handlers are thread-safe or update them to make them thread-safe.

If the value of this key is true, then the handler may be executed on a non-main thread and it may be executed concurrently from multiple threads. If false, it will only be executed on the main thread. This key is required for event handlers, and must not be present for coercion handlers, which are required to be thread-safe. If a coercion handler cannot be made safe to run on background threads, the handler must arrange to execute the coercion on the main thread, such as using by using libdispatch and the main dispatch queue.

Read more: http://developer.apple.com/library/mac/technotes/tn1164/_index.html#//apple_ref/doc/uid/DTS10003003-CH1-MAC_OS_X_V10_6__SNOW_LEOPARD__AND_LATER__INFO_PLIST

Related issues:

https://code.google.com/p/simbl/issues/detail?id=7 https://code.google.com/p/simbl/issues/detail?id=38

Other:

https://code.google.com/p/simbl/issues/detail?id=14 https://code.google.com/p/simbl/issues/detail?id=66 https://code.google.com/p/simbl/issues/detail?id=67 https://code.google.com/p/afloat/issues/detail?id=43