I finally read the gc rooted guide, and it makes my head spin,
especially since I am still learning C++ on top of it.
I wanted to start at the heart of the matter, jwin,
which is a global pointer to a js object.
The guide talks about local variables, parameters, returns,
heap, but nothing about global or static.
So from the start I am a bit lost.
But I think I will pretend like it is a local variable,
that just never goes out of scope.
So should be declared and defined like this.
[extern] JS::RootedObject *jwin;
Ok then a context switch, moving from buffer 1 to buffer 3,
needs to swap in the new java window.
This is done by jMyContext().
at 1109,
jwin = cw->jsw;
This should work, even if jsw remains void * as it is today.
Should be ok.
But how is it set in the first place?
line 877
jwin = JS_NewGlobalObject(jcx, &window_class, NULL);
I assume NewGlobalObject is part of their API?
I don't see it in my stuff.
Anyways what does it return?
If just an object pointer then it is not rooted,
and maybe should be
jwin = new JS::RootedObject(jcx, JS_NewGlobalObject(jcx, &window_class, NULL));
When we quit a buffer, or ^ to pop the stack, we would free this window,
I suppose by a delete operation,
I wonder if that would clean everything up properly?
Well this is probably the first in a long line of
thoughts, observations, etc, trying to put it all together.
The rooted guide suggests we have to change everything touching js objects.
Unless it is really just stored as void * like cw->jsw, which is probably ok.
But when we use them in any way shape or form, well you know.
Karl Dahlke
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev