Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crashes with Javascript




On 16 May 2005, at 03:22, Pierre-Olivier Latour wrote:

I've attached a small composition that I'm working on. I've hit a problem whereby quartz composer crashes each time I amend some javascript code. I suspect it's because I'm using an output to store a string, and there is a problem perhaps with objects being released but then accessed on the second pass through the javascript code?
To get an immediate crash, uncomment the line of code near the bottom in the javascript patch - there's only one. Am I doing something really stupid here?

That's indeed a bug either in Quartz Composer or JavaScript. In any case, you don't need to build / unbuild a string to store your block states. Just put the Array directly on the JavaScript patch output


outputs[0] = new Array(160);

Okay, done that and it did improve stability. However, I've now got a little bit more javascript code in place and the instability is back, although not quite as bad as before. I've attached the composition again - this time, just opening the viewer showing and closing the viewer window a couple of times is enough to kill quartz composer.


I'm thinking that any further Adventures in Javascript are going to be an exercise in patience (and frequent saves!) until there's an update to the quartz composer framework that addresses this instability. Is anyone else experiencing similar problems? I do understand that the main focus of quartz composer is the graphical, non-programming side of things and why, in the short term, JS probably isn't all that high in the list of priorities.

JS arrays are converted to structures automatically on the outputs, so use Member At Index patch to access a block state directly

Thanks - this works well.

I wonder if there is a reference for the javascript tool? I've had a look around but can't find anything (other than a brief note of the data types supported). A list of the objects & functions supported would be nice.

Quartz Composer supports the standard JavaScript Core: Google for documentation and you'll find plenty

Couple of questions / comments that I've not been able to find answers to:


1- If the javascript contains functions, is it necessary to separate these somehow from the 'main' part of the code? (I believe the answer is no).

2 - The javascript tool does not get executed repeatedly unless it has connected inputs. In the attached composition, if the LFO is removed then the javascript is called only once. Which I think is wrong - as I understand it, a patch should be executed whenever a dependent patch requests data from it - with the added complication that data required by a published input to a macro patch would cause the patch feeding the macro patch to be called just once per frame, even if the macro was of the repeating variety and effectively uses the data many times?

3 - Performance - This composition, which is really just a few cubes spinning round in space, seems to put a heavy load on the computer. The load indicator in the viewer window moves from 35 to 70% - this is on a 1.67 powerbook. I've experimented with taking out various patches and it does seem to be the cube that has the heaviest impact on performance.

Thanks for your help so far!

Edward

Attachment: TetrisSaver2.qtz
Description: application/quartzcomposer

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden

References: 
 >Crashes with Javascript (From: Edward Brown <email@hidden>)
 >Re: Crashes with Javascript (From: Pierre-Olivier Latour <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.