[FAQ] [VSDK] Crash in VDK_ObjectPtr constructor

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Jan 31 09:59:55 CST 2003


on 1/31/03 9:10 AM, Eric Forget at forgete at cafederic.com wrote:

> Hi,
> 
> With the 1.9.6 and latest beta, I crash when I try to debug. It crashes in
> the construction of my VDK_BaseObject-derived class construction. The new()
> receives a size of 2863312896 (decimal!) which is a way to big. The stack is
> below:
> 
> #5    0x004e61d0 in operator new(unsigned long)
> #6    0x004e6138 in operator new[](unsigned long)
> #7    0x004fe96c in FBL_Array<VDK_Link*>::Resize(unsigned long)
> #8    0x004872cc in VDK_ObjectPtr::VDK_ObjectPtr(char const*,
> VDK_BaseObject*, FBL_DeletionControl)
> 
> I've tried to open the database with VAPP without problem. The Diagnose
> command returns "All Right!"
> 
> But after some testing I found that the problem had to do with the order the
> tables a created.
> 
> Table 1
> -------
> String
> ObjectPtr -> Table 2
> 
> Table 2
> -------
> String
> 
> Is this really not allowed? If this is not it means that there is cases of
> circular dependencies which are also not allowed too!

Hi Eric,

Of course this is not correct. ObjectPtr require BaseObject*,
Yes? So you must have instance of BaseObject to send it to ObjectPtr
constructor.

We still can have circular dependencies!

To do this, you need:

A) in ObjectPtr constructor send NULL

B) LATER, when you have all BaseObjects you need created,
    you can call 
        
        table1.ptr.setTatget( table2 );

Usually constructor of YuorDatabase() is good place to do this.

And I think this is quite normal logically.
At first you create Tables, later you specify links between tables.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list