Changing objects in AtomArray crash



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/10/2005 at 05:47, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.5 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi,

    I have an AtomArray that contains a list of objects that are in the document.

    I am right in saying that the AtomArray stores a list of pointers to the objects in the document?

    The reason I ask her because of this situation

    1. I create a Cube Primitive using C4D
    2. I add that cube to the AtomArray using AtomArray::Append(BaseDocument::GetActiveObject())
    3. In C4D, I use the Make Editable command , or delete the object, or change it another way etc

    What happens with the pointer under the AtomArray?
    From my tests there is still a valid pointer, but its not pointing to anything, and I recieve a crash when trying to access the objects properties

    Thanks



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/10/2005 at 10:35, xxxxxxxx wrote:

    The pointer under the AtomArray would become invalid if you delete the object. Just because the pointer isn't NULL, doesn't mean it points to valid memory any more (the 'dangling pointer' case in C/C++) - it points to memory whose resources were reallocated back to the system for reuse.

    I'm not totally certain of this, but the atom in the AtomArray may need to be in a document to remain valid.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/10/2005 at 11:50, xxxxxxxx wrote:

    A safer way is to store a collection of BaseLinks. Then you can safely see if they are valid before you try to use them.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/11/2005 at 23:32, xxxxxxxx wrote:

    Hi,

    I'm having this same problem. Since I'm new to c++ I don't quite understand the documentation for baselinks. I was told previously that a BaseLink array cannot be stored in a container, but can you create one and store it in the hyperfile? Or am I just thinking about this the wrong way all together and should be using a loop or something to store links in a BaseContainer. And with this baselink concept, where do atomarrays fit in? Do they have any real use besides as a short term method to store groups of objects?

    Please help. Thanks.
                       Aaron M.


Log in to reply