Custom Member Crashes



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

    On 15/11/2012 at 07:38, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   14 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hallo,
    I have a problem with a Tag Plugin, which is crashing if I delete an unnecessary Variable from the Header. So I came to thinking that I might be doing something that is forbidden anyway. My header looks like this:

    class TransferTag : public TagData
    {
        private:
            BaseContainer ChangesBC; //unnecessary BaseContainer
            CTransfer * CTrans; //custom class
            Real AreaRadius;
        
        public:
            virtual Bool Init(GeListNode *node);
            virtual void Free(GeListNode* node);
            static NodeData *Alloc(void) { return gNew  TransferTag; }
        
            CTransfer * GetTransfer(BaseObject * Asker, Real Radius); //custom member function
    };

    The function "GetTransfer" is called by other Plugin Objects and returns *CTrans from private. Is it allowed to do so?
    Thanks
    Jonnz



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

    On 15/11/2012 at 10:00, xxxxxxxx wrote:

    Hi Jonnz,

    yes it is allowed. Have you recompiled all other files that reference your plugin? The relative
    memory location of the *CTrans has changed and object files that were
    compiled with previous version reference it from the wrong position. Although you are not
    accessing the attribute directly, but through a function call, there may be the possibility the
    compiler has inlined the function (depending on your compiler options).

    I currently can't think of another reason.

    Best,
    Niklas



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

    On 15/11/2012 at 13:16, xxxxxxxx wrote:

    Hi Niklas,
    thanks for your help. I'm happy to know that it's allowed to do that, so I can keep working. 
    Since I have cleaned the project several times and checked if the compiler is inlineing the function, I guess the problem must lie somewhere else.

    Regards
    Jonnz


Log in to reply