[MacRuby] #1405: Crash using ScriptingBridge with OmniFocus

MacRuby ruby-noreply at macosforge.org
Sun Oct 9 07:58:33 PDT 2011


#1405: Crash using ScriptingBridge with OmniFocus
------------------------------------+---------------------------------------
 Reporter:  gerrit@…                |       Owner:  lsansonetti@…        
     Type:  defect                  |      Status:  new                  
 Priority:  minor                   |   Milestone:                       
Component:  MacRuby                 |    Keywords:                       
------------------------------------+---------------------------------------
 The following code

 {{{
 framework 'ScriptingBridge'
 omnifocus = SBApplication.applicationWithBundleIdentifier
 'com.omnigroup.omnifocus'
 doc = omnifocus.defaultDocument
 doc.folders.first.projects.first.rootTask.tasks.first.name
 }}}

 crashes macruby with the following error message:

 {{{
 2011-10-09 15:53:54.911 macruby[7872:e07] -[SBObject classForCode:]:
 unrecognized selector sent to instance 0x401343980
 uncaught Objective-C/C++ exception...
 2011-10-09 15:53:54.916 macruby[7872:e07] *** Terminating app due to
 uncaught exception 'NSInvalidArgumentException', reason: '-[SBObject
 classForCode:]: unrecognized selector sent to instance 0x401343980'
 *** First throw call stack:
 (
         0   CoreFoundation                      0x00007fff93ac0986
 __exceptionPreprocess + 198
         1   libobjc.A.dylib                     0x00007fff8e945d5e
 objc_exception_throw + 43
         2   CoreFoundation                      0x00007fff93b4c5ae
 -[NSObject doesNotRecognizeSelector:] + 190
         3   CoreFoundation                      0x00007fff93aad803
 ___forwarding___ + 371
         4   CoreFoundation                      0x00007fff93aad618
 _CF_forwarding_prep_0 + 232
         5   ScriptingBridge                     0x00007fff91f9e924
 -[SBElementArray elementClass] + 56
         6   ScriptingBridge                     0x00007fff91f9ea3d
 -[SBElementArray objectWithKeyForm:keyData:] + 81
         7   ScriptingBridge                     0x00007fff91f9eaa5
 -[SBElementArray objectAtIndex:] + 60
         8   libmacruby.dylib                    0x000000010016a657
 rb_ary_freeze + 12007
         9   libmacruby.dylib                    0x000000010013e161
 rb_vm_dispatch + 8833
         10  ???                                 0x0000000101f00544 0x0 +
 4327474500
         11  ???                                 0x0000000101f095b7 0x0 +
 4327511479
         12  libmacruby.dylib                    0x0000000100154233
 rb_vm_run + 531
         13  libmacruby.dylib                    0x0000000100030ca0
 ruby_run_node + 80
         14  macruby                             0x0000000100000cf8 main +
 152
         15  macruby                             0x0000000100000c54 start +
 52
         16  ???                                 0x0000000000000004 0x0 + 4
 )
 terminate called throwing an exception

 }}}

 specifically accessing the “tasks” collection on any rootTask object
 (which according to the omnifocus applescript dictionary is present)
 causes this crash. Accessing a collection that is actually not there (like
 the error message suggests) only yields a standard ruby NoMethodError:

 {{{
 untitled:7:in `<main>': undefined method `wurst' for
 #<OmniFocusTask:0x400eefb40> (NoMethodError)
 /Users/gerrit/Library/Application
 Support/TextMate/Bundles/Ruby.tmbundle/Support/RubyMate/catch_exception.rb:14:in
 `block': not opened for writing (IOError)

 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1405>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list