Skip to content

Conversation

samdeane
Copy link
Contributor

This is an evolution of the code in PR #34. We've had some crashes reported for Sketch using that code, so I've refined it further.

I still don't think I've got all the crashes out, so I will probably have to reinstate the JSValueProtect hack in the meantime.

Debugging this code is quite interesting though.

I've downgraded a couple of the assertions to just be debug() statements, and I get the "box should have been disassociated" one firing occasionally, seemingly when things are being cleaned up.

It looks like it's firing for something that was passed as a parameter in a function call, though I'm not 100% certain.

samdeane and others added 30 commits April 30, 2014 11:41
Unfortunately there's no other way to suppress them optionally that I can find, and they were the only warnings in our build.
Import paths can be in the format:

    relative/to/script.js
    /absolute/path/to/script.js
    ~/relative/to/home/script.js
BohemianCoding/Sketch#3319 Script import: Add support for absolute and ~ paths
Also guards against multiple imports of the same URL, and therefore circular imports

Ref BohemianCoding/Sketch#3319
BohemianCoding/Sketch#3319 Add support for nested @import statements
Fix a bug which ignored first line of @import-ed scripts
The theory here is that JS references to objects may be in the ffi arguments as raw pointers, so it's a good idea to protect everything. May be spurious...
…get created but aren't referenced from JS anywhere at the point the struct is made, so I suspect that they might be destroyed again immediately.
We will "leak" any object in the map until the JS reference is garbage collected, or until the end of the script session - which is not ideal, but better than crashing.
# Conflicts:
#	Cocoa Script.xcodeproj/project.pbxproj
#	src/framework/mocha/MochaRuntime.m
#	src/framework/mocha/Objects/MOBox.m
Make sure that boxes get dissassociated and clean out the JS object's private pointer, before they are dealloced.
@samdeane
Copy link
Contributor Author

(if we ever conclude that this code is good, I can make more of an attempt to factor it out into some more manageable PRs - for now this is mostly just FYI)

@samdeane samdeane force-pushed the feature/7496-latest-sketch-beta-crashes branch from 4f65077 to 363a1eb Compare January 18, 2016 13:06
@ccgus
Copy link
Owner

ccgus commented Jan 18, 2016

Thanks- I'll take a look at this when I get a chance. I'd like to merge in all your changes as well- but there's some stuff that I need to sort through and figure out what's breaking Acorn.

@samdeane
Copy link
Contributor Author

Sure - no hurry, and just yell if you need a hand disentangling our stuff :)

@samdeane samdeane closed this Jan 19, 2016
@samdeane samdeane deleted the feature/7496-latest-sketch-beta-crashes branch January 19, 2016 17:39
@samdeane
Copy link
Contributor Author

Oops - this branch got deleted on our end, so the PR went away. I'll make another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants