[bt-devel] FATAL ASSERT in my BibleTime 2.0 beta1 package

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Fri Apr 24 12:51:46 MST 2009


Jonathan Marsden wrote:
> Crash report: I'm seeing
> 
> (BibleTime 2.0.beta1) _FATAL_: ASSERT: "sourceList.count() > 0" in file
> /home/jonathan/packages/sword/bibletime/build-area/bibletime-2.0~beta1/src/frontend/bookshelfmanager/installpage/btsourcewidget.cpp,
> line 224

If no install sources are found when you open the dialog, it creates the 
CrossWire source and adds it to the backend source list. The assertion 
gets the source list and makes sure that the source has really been 
added. I don't understand why it doesn't succeed. I just upgraded the 
packages from your repo: libsword8 and bibletime 2.0beta1. I removed my 
existing instmgr configuration and opened BT and the b.s.mgr - it worked 
fine.

Here is the code:

QStringList sourceList = instbackend::sourceList();
if (!sourceList.count()) {
	sword::InstallSource is("FTP");
	is.caption = "Crosswire";
	is.source = "ftp.crosswire.org";
	is.directory = "/pub/sword/raw";
	instbackend::addSource(is);
	sourceList = instbackend::sourceList();
	Q_ASSERT( sourceList.count() > 0 );
}

The instbackend namespace has these functions:

bool addSource(sword::InstallSource& source)
{
	qDebug("backend::addSource");
	SWConfig config(configFilename().toLatin1());
	if (!strcmp(source.type, "FTP")) {
		//make sure the path doesn't have a trailing slash, sword doesn't like it
		if (source.directory[ source.directory.length()-1 ] == '/') {
			source.directory--; //make one char shorter
		}

		config["Sources"].insert( std::make_pair(SWBuf("FTPSource"), 
source.getConfEnt()) );
	}
	else if (!strcmp(source.type, "DIR")) {
		config["Sources"].insert( std::make_pair(SWBuf("DIRSource"), 
source.getConfEnt()) );
	}
	config.Save();
	return true;
}

QStringList sourceList()
{
	qDebug("backend::sourceList");
	BtInstallMgr mgr;
	Q_ASSERT(mgr.installConf);

	QStringList names;

	//add Sword remote sources
	for (InstallSourceMap::iterator it = mgr.sources.begin(); it != 
mgr.sources.end(); it++) {
		names << QString::fromLocal8Bit(it->second->caption);
	}

	// Add local directory sources
	SWConfig config(configFilename().toLatin1());
	sword::SectionMap::iterator sourcesSection = 
config.Sections.find("Sources");
	if (sourcesSection != config.Sections.end()) {
		sword::ConfigEntMap::iterator sourceBegin = 
sourcesSection->second.lower_bound("DIRSource");
		sword::ConfigEntMap::iterator sourceEnd = 
sourcesSection->second.upper_bound("DIRSource");

		while (sourceBegin != sourceEnd) {
			InstallSource is("DIR", sourceBegin->second.c_str());
			names << QString::fromLatin1(is.caption.c_str());

			sourceBegin++;
		}
	}

	return names;
}


--Eeli Kaikkonen



More information about the bt-devel mailing list