From: Chris Brannon <chris@the-brannons.com>
To: edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] garbage collection1
Date: Fri, 24 Jan 2014 06:21:21 -0800 [thread overview]
Message-ID: <878uu5qx3y.fsf@mushroom.PK5001Z> (raw)
In-Reply-To: <20140124105929.GC12450@toaster.adamthompson.me.uk> (Adam Thompson's message of "Fri, 24 Jan 2014 10:59:29 +0000")
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
Adam Thompson <arthompson1990@gmail.com> writes:
>> We should not be passing unrooted jsval as the fourth
>> argument to JS_DefineProperty as this can also lead to a crash.
>
> Yeah, I'm not sure how to work around this.
I am, and a patch is attached. There may be other cases. I can look through
the code for them. I fixed the one I noticed.
> If you could test the latest code that'd be useful (corrected jwin and uo rooting).
I'm not seeing it. All I see is that you merged the master branch back
into your repo. Did you forget a push?
PS. Thank you very much for all of your work on this!
-- Chris
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rootedval.diff --]
[-- Type: text/x-diff, Size: 1171 bytes --]
diff --git a/src/jsdom.cpp b/src/jsdom.cpp
index 7f3eef3..9c12bd7 100644
--- a/src/jsdom.cpp
+++ b/src/jsdom.cpp
@@ -1243,13 +1243,13 @@ Yeah, it makes my head spin too.
} else {
v = JS_NewObject(jcx, cp, NULL, owner_root);
}
- vv = OBJECT_TO_JSVAL(v);
+ JS::RootedValue rvv(jcx, OBJECT_TO_JSVAL(v));
/* if no name, then use id as name */
if(!symname && idname) {
- JS_DefineProperty(jcx, owner_root, idname, vv, NULL, NULL, attr);
+ JS_DefineProperty(jcx, owner_root, idname, rvv, NULL, NULL, attr);
} else if(symname && !dupname) {
- JS_DefineProperty(jcx, owner_root, symname, vv, NULL, NULL, attr);
+ JS_DefineProperty(jcx, owner_root, symname, rvv, NULL, NULL, attr);
if(stringEqual(symname, "action"))
establish_property_bool(v, "actioncrash", eb_true, eb_true);
@@ -1259,7 +1259,7 @@ Yeah, it makes my head spin too.
establish_property_object(master, symname, v);
} else {
/* tie this to something, to protect it from gc */
- JS_DefineProperty(jcx, owner_root, fakePropName(), vv,
+ JS_DefineProperty(jcx, owner_root, fakePropName(), rvv,
NULL, NULL, JSPROP_READONLY | JSPROP_PERMANENT);
}
next prev parent reply other threads:[~2014-01-24 14:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 20:27 [Edbrowse-dev] garbage collection Chris Brannon
2014-01-24 10:59 ` [Edbrowse-dev] garbage collection1 Adam Thompson
2014-01-24 14:21 ` Chris Brannon [this message]
2014-01-24 14:58 ` Adam Thompson
2014-01-24 22:07 ` Chris Brannon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878uu5qx3y.fsf@mushroom.PK5001Z \
--to=chris@the-brannons.com \
--cc=edbrowse-dev@lists.the-brannons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).