Skip to content

BaseObject's parent pointer variable not initialized? #14

@sigmareaver

Description

@sigmareaver

I'm working on a serializer for ImStudio so that I can save and load GUI projects (using yaml-cpp).

Admittedly, I'm not super familiar with how ImStudio stores and looks up children/parents, or rather, how the object hierarchy works, at the moment.

I wrote something like this pseudo code:

    if (obj.parent)
        out << "ParentID" << obj.parent->id;
    else
        out << "ParentID" << 0;

I then tested this serialization with a few widgets (no nesting) in a window, and the objects' parent ID always serialize as:
ParentID: 30198988
(This turns out to be 0x01CCCCCC, probably some kind of magic number.)
I tried adding the line parent = nullptr; to BaseObject's constructor, but this doesn't seem to make a difference.
And also, when I put in a break point and look at the object that is currently being serialized, the obj.parent doesn't appear to be valid memory.

I was hoping you might be able to see if you have similar results with your object.parent, or if it's just something I did.

Also, I did notice that in the Object constructor, it seems to set itself as the parent of itself, so I'm thinking I may be misunderstanding your data structure, and it isn't tree-like?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions