Program exits with signal 11 (SIGSEGV).

Matthew Jew mjew at icnc.com
Mon Jul 21 02:50:21 CDT 2003


Ruslan,

Another Cocoa question.

This routine causes the program to exit with signal 11 (SIGSEGV).

- (void) writeGroupListToDB
{
     ValentinaDatabase * _database = [[ValentinaDatabase alloc] init];
	NewsgroupTable * aNewsgroupTable;
	long i;
	GroupInfoRec *baseRecPtr;
	GroupInfoRec *aRecPtr;
	char *baseStringPtr;
	char *groupName;

	printf("Started writeGroupListToDB\n");
	
	[_database  
createDatabaseWithFileName:@"/Volumes/Beta2/ValentinaDBs/ 
SampleNewsgroupListDB"];
	printf("Created DB\n");
	
	aNewsgroupTable = [_database databaseDefinition]->getNewsgroupTable();
	printf("Get Table pointer\n");
	
     aNewsgroupTable->SetBlank();
	printf("Set Blank\n");

	baseRecPtr = (GroupInfoRec *) [groupInfo mutableBytes];
	baseStringPtr = (char *) [stringPool mutableBytes];

	aRecPtr = baseRecPtr;
	for ( i = 0; i < groupsInList; i++ )
	{
		groupName = baseStringPtr + aRecPtr->nameOffset;

		[_database databaseDefinition]->getNewsgroupTable()->mfNewsgroupName  
= groupName;
		[_database  
databaseDefinition]->getNewsgroupTable()->mfNewsgroupNumber =  
aRecPtr->groupNumber;

		[_database databaseDefinition]->getNewsgroupTable()->AddRecord();

		++aRecPtr;	// Pointer math
	}
	printf("Done adding\n");
	[_database databaseDefinition]->getNewsgroupTable()->Flush();
	printf("Database flushed\n");
	[_database close];
	printf("Database closed\n");
     [_database release];
	printf("Database released\n");
}

- Matthew



More information about the Valentina mailing list