Re: Is't wrong to store a GC thing on a map JSObject *
Boris Zbarsky <[email protected]> Thu, 11 Apr 2019 12:09:11 -0400
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
On 4/11/19 9:13 AM, msami wrote: > I want to have a map that carries rootedObject is that achievable? RootedObject is only allowed to be used on the stack. So you can't store it in a map, no. Depending on the rooting behavior you want, you could try to use a PersistentRooted for the value, or use a Heap<JSObject*> and trace your map. In the former case, of course, you will need to deal with the fact that a PersistentRooted needs a JSContext or JSRuntime to be initialized. -Boris