Crash 'EXC_BAD_ACCESS' when calling CreateDatabase() in C++ VSDK

Matthew Jew mjew at icnc.com
Wed May 31 15:07:45 CDT 2006


On May 31, 2006, at 2:51 PM, Ruslan Zasukhin  
<sunshine at public.kherson.ua> wrote:

> On 6/1/06 12:45 AM, "Matthew Jew" <mjew at icnc.com> wrote:
>
>>>> #0 0x0065ac88 in fbl::String::String
>>>> #1 0x010d3514 in fbl::Localizable_Imp::MakeDefaultLocale
>>>> #2 0x010d3f0c in fbl::Localizable_Imp::InitRoot
>>>> #3 0x010d4138 in fbl::Localizable_Imp::Localizable_Imp
>>>> #4 0x010cb360 in fbl::Database::Database
>>>> #5 0x0100d200 in fbl::CreateDatabase
>>>>
>>>> I called ValentinaInit() before my call to CreateDatabase(). I'm  
>>>> not
>>>> sure what I'm missing.
>>>
>>>> I am using the latest Valentina VSDK for C++ universal build
>>>> and I am using XCode 2.3 on Mac OS X 10.4.6 with the latest patches
>>>> applied.
>>>
>>> Have you try run VSDK examples?
>>> Are they working ?
>>>
>>> I ask to see if problem is in VSDK itself or in your code ...
>>>
>>
>> Ruslan,
>>
>> Yes, I can compile and run the VSDK examples.
>>
>> I wish I could figure out what about my project is wrong...
>
> So you are sure that Valentina.Init() was called...okay
>
> Do you create database as
>         FBL::CreateDatabase()
> Or
>         VSQL::CreateDatabase()
>
>
> May be show me your code from init Valentina to CreateDatabase.
>
> I really have no idea why it crashes for you.
> Crash in string. Sounds like ValentinaInit was not done.
>
>
>
> -- 
> Best regards,
>
> Ruslan Zasukhin


The database is created when my C++ object is created.

The object constructor is:

DbValentinaBase::DbValentinaBase()
{
	// This routine knows not to initialize more than once
     PVInitializeDBSystem();

	DB = FBL::CreateDatabase();
}

// And the initializing routine is:

static long	gPVDBSystemRefCount	= 0;

static unsigned long gPVSizeOfDBCache = 0;
static unsigned long gPVDefaultSizeOfDBCache = 16 * 1024 * 1024;

void PVInitializeDBSystem( unsigned long cacheSize )
{
	unsigned long cacheSizeToUse;
	
	if ( gPVDBSystemRefCount <= 0 )
	{
		if ( cacheSize > 0 )
		{
			cacheSizeToUse = cacheSize;
		} else {
			cacheSizeToUse = gPVDefaultSizeOfDBCache;
		}
		
		// initialize the Valentina kernel: cache size, MacOS serial  
number, Windows serial number
		gPVSizeOfDBCache = ValentinaInit( cacheSize,  
kOurValentinaSerialNumber, NULL );
		printf( "ValentinaInit: gPVSizeOfDBCache = %lu\n",  
gPVSizeOfDBCache );	// DEBUG: REMOVE LATER Prove we initialized
		
		gPVDBSystemRefCount = 1;
	} else {
		++gPVDBSystemRefCount;
	}
}

- Matthew




More information about the Valentina mailing list