From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from qmta06.westchester.pa.mail.comcast.net (qmta06.westchester.pa.mail.comcast.net [IPv6:2001:558:fe14:43:76:96:62:56]) by hurricane.the-brannons.com (Postfix) with ESMTP id 4122E7788B for ; Sat, 25 Jan 2014 08:47:52 -0800 (PST) Received: from omta01.westchester.pa.mail.comcast.net ([76.96.62.11]) by qmta06.westchester.pa.mail.comcast.net with comcast id JG1d1n0030EZKEL56Gnb2B; Sat, 25 Jan 2014 16:47:35 +0000 Received: from eklhad ([107.5.36.150]) by omta01.westchester.pa.mail.comcast.net with comcast id JGnb1n00R3EMmQj3MGnbXq; Sat, 25 Jan 2014 16:47:35 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke User-Agent: edbrowse/3.4.10 Date: Sat, 25 Jan 2014 11:47:36 -0500 Message-ID: <20140025114736.eklhad@comcast.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1390668455; bh=wgjtuRxHHGipnanQAP4FGkl2BB7oiyMJN0vVqjYxFXk=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=RrPnE+j1SjSW5YIkescp/nkZi9M4pHfQ33ULiVeFVPhqxh1Pg6yRlbZnILA/2foEy +bq6mW85siIt4isSO8bmdhQVa5aiPjtVY+TRxEUrErBzPdz+T5oRf9r1v5wXnzVizH AKcw6cgKFsgcgM+LROYZSt5GWAStFzBiqLm5SehODmQUaVuStpXpAJIVbAFon5U2NS NQZDA0YVdZYGZZq6JJJS6Hks/0z2SeSizcER1CSzUN7jSYJnvLgVJAEvLjEdaU/3Ya ox/9DAua4JhsqFjdrYieyz1lsL9VLHd1y/CfdDUXR0ltpLX6/FwMMyY/5K/IDar5qT seB3q2GaUMXNA== Subject: [Edbrowse-dev] gc rooted X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Karl Dahlke List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 16:47:52 -0000 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