I've updated my userscript to reflect this. Just a quick trial/error right now seems to indicate this works. I had to create separate setTimeouts for each add/remove, not just of the same item for it not to crash. This should really be handled better in Fluid.
Aaron On Aug 11, 4:09 pm, fuzzygroove <[email protected]> wrote: > Hey Aaron, > > It looks like this is a race condition with removing/adding an item > with the same name too quickly. I was able to get around this bug by > setting a timeout before redrawing the menu items (I'm working on a > similar play/pause menu). > > I hope the menu items API gets a little more robust, with separators > and the ability to set toggle state (the check mark to the left) or > even a little icon. But in the meantime, at least the app doesn't > crash :) > > -ian > > On Jul 26, 6:02 pm, Aaron Zinman <[email protected]> wrote: > > > > > The userscript in question lives > > here:http://userscripts.org/scripts/review/54392 > > > I'm having issues where my dock menu item script doesn't seem to work > > right. I keep getting exceptions, sometimes they just spit out on the > > console and it doesn't matter, other times it crashes Fluid. Here is > > a typical example: > > > 2009-07-26 20:41:24.174 FluidInstance[3257:10b] Exception raised: > > --------------------------- > > Mask: 0x00000004 > > Name: NSUncaughtSystemExceptionException > > Reason: Uncaught system exception: signal 11 > > Stack Trace: > > NSExceptionHandlerUncaughtSignalHandler (in ExceptionHandling) + 65 > > _sigtramp (in libSystem.B.dylib) + 43 > > 0xffffffff > > -[TODJavaScriptFluidObject menuItemClick:] (in FluidInstance) + 113 > > -[NSApplication sendAction:to:from:] (in AppKit) + 112 > > -[NSMenu performActionForItemAtIndex:] (in AppKit) + 493 > > _NSCoreDockMessageReceive (in AppKit) + 975 > > DockCallback(unsigned long, unsigned int, void*, void*) (in HIToolbox) > > + 2127 > > _DCXDoMenuCommand (in HIServices) + 71 > > _XDoMenuCommand (in HIServices) + 138 > > mshMIGPerform (in HIServices) + 517 > > CFRunLoopRunSpecific (in CoreFoundation) + 3896 > > CFRunLoopRunInMode (in CoreFoundation) + 88 > > RunCurrentEventLoopInMode (in HIToolbox) + 283 > > ReceiveNextEventCommon (in HIToolbox) + 374 > > BlockUntilNextEventMatchingListInMode (in HIToolbox) + 106 > > _DPSNextEvent (in AppKit) + 657 > > -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in > > AppKit) + 128 > > -[NSApplication run] (in AppKit) + 795 > > -[OAApplication run] (in OmniAppKit) + 580 > > NSApplicationMain (in AppKit) + 574 > > start (in FluidInstance) + 54 > > 0x1 > > > --------------------------- > > Segmentation fault > > > I believe it has to do with pointers to functions that get garbage > > collected. I keep trying to re-write this with more things global and > > what not. > > > Here's an exception that doesn't quit and still does the right thing: > > > 2009-07-26 20:40:07.930 FluidInstance[3250:10b] Exception raised: > > --------------------------- > > Mask: 0x00000040 > > Name: NSInvalidArgumentException > > Reason: *** -[NSCFString _rootObject]: unrecognized selector sent to > > instance 0xf146290 > > Stack Trace: > > NSExceptionHandlerExceptionRaiser (in ExceptionHandling) + 185 > > objc_exception_throw (in libobjc.A.dylib) + 40 > > CFRunLoopRunSpecific (in CoreFoundation) + 4355 > > CFRunLoopRunInMode (in CoreFoundation) + 88 > > RunCurrentEventLoopInMode (in HIToolbox) + 283 > > ReceiveNextEventCommon (in HIToolbox) + 374 > > BlockUntilNextEventMatchingListInMode (in HIToolbox) + 106 > > _DPSNextEvent (in AppKit) + 657 > > -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in > > AppKit) + 128 > > -[NSApplication run] (in AppKit) + 795 > > -[OAApplication run] (in OmniAppKit) + 580 > > NSApplicationMain (in AppKit) + 574 > > start (in FluidInstance) + 54 > > 0x1 > > > --------------------------- > > 2009-07-26 20:40:12.318 FluidInstance[3250:10b] *** -[NSCFString > > _rootObject]: unrecognized selector sent to instance 0xf147200 > > > I have no idea if this is my fault or Fluid's. I mean, Fluid def > > shouldn't crash because of a userscript issue, but perhaps I'm still > > doing something stupid as well. Any suggestions? > > > Thanks, > > Aaron --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "fluidapp" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluidapp?hl=en -~----------~----~----~----~------~----~------~--~---
