On Sep 16, 2014, at 10:28 PM, Christian Schmitz 
<[email protected]> wrote:
> 
> Could you reproduce this for me?
> 

Well, it turns out to be pretty tough but I do think I have an explanation for 
it.


>> You see the "JSONMBS.__exit” that leads to the crash?
> 
> Yes. Destructor frees memory which it should not free.
> 

sounds about right, see below

>> Also, this seems to be isolated to my creation of new JSON nodes using 
>> AddItemToObject and the like. Other objects in our code that create JSONMBS 
>> nodes through the parsing of JSON text seem to be destroyed without crashes…
> 
> Well, there could be a problems with owner.
> I mean if two Xojo objects think they need to free the same object, it'll 
> crash.
> 

OK, so here’s the scenario:

Our app receives some JSON from our server and parses it. It stores some of the 
JSONMBS “subtree” in a class property. Later on, when we want to save data to a 
local database, we link that stored JSONMBS “subtree” into a larger JSONMBS 
structure using .addItemToObject and then get JSON text from the overall 
JSONMBS structure.

So, the JSONMBS “subtree” is still referenced by the class property as well as 
being part of the larger JSONMBS structure. This seems to result in double 
destruction and a crash.

It worked fine with dictionaries in the earlier version so it seems like it 
could be done…?

Anyway, as a workaround I convert the stored subtree into text and then parse 
it into a new JSONMBS structure before linking it into the larger structure. 
Seems to work OK but probably slows things down some.


>> Also, JSONMBS seems to be based on a library. Can you send a link to the 
>> documentation for this library. There are a few concepts (like null nodes, 
>> etc) that the MBS dox just don’t demystify.
> 
> What concepts?
> 

well, False nodes, Null nodes, True nodes, etc. I have no idea what a null node 
should be and the current MBS description of NewNullNode as "Creates a new null 
node” doesn’t go much beyond a description of the obvious.

> 
> it's cJSON:
> http://cjson.sourceforge.net

cool, thanks. A reference (and perhaps a link) in the dox to external libraries 
would be great. Then you don’t have to duplicate & maintain their documentation.

thanks!

Steve


_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to