crash with codecompletion
Harald Fernengel
harry at kdevelop.org
Fri Mar 1 03:18:03 UTC 2002
Hello,
simply copy&paste the code below into your favourite project (don't compile),
goto the end of the function (or after the final } ) and press ".". I'm
getting a nice segfault and I'm out of ideas how to fix it.
It crashes in Simpleparser.h:71 (KDE2 as well as KDE3):
void add( const SimpleVariable& v )
{ qDebug( "before crash" ); m_vars.append( v ); qDebug( "never arrives
here" );}
but I cannot see where, m_vars is a QValueList and v is a const reference... I
played around by changing it to non-inline but nothing worked. The
constructor and operator= of SimpleVariable are okay, too... Can anyone
please try to reproduce the crash and give me an idea what can go wrong?
Thanks,
Harry
void kio_sqlProtocol::get(const KURL& url )
{
kdDebug() << "kio_sql::get(const KURL& url): " << url.prettyURL() << endl ;
QString host = url.host();
int port = url.port();
if ( port == 0 ) {
// if no port is given, then we assume the default
port = -1;
}
QString path = url.path();
QString user = url.user();
QString passwd = url.pass();
QString query = url.queryItem( "query" );
QString plugin;
QString database;
QString table;
QStringList l = QStringList::split("/", path);
if (l.count() > 0) {
plugin = l[0]; // the first part of the path is the plugin
}
if (l.count() > 1) {
database = l[1]; //the second is the database
}
if (l.count() > 2) {
table = l[2];
}
mimeType( "text/html" );
infoMessage( i18n("Querying %1:%2 ...").arg( host ).arg( port ) );
QString theData;
if ( !checkPlugin( plugin, theData ) ) {
data( QCString( theData.local8Bit() ) );
finished();
return;
}
QSqlDatabase* db = QSqlDatabase::addDatabase( plugin );
db->setDatabaseName( database );
db->setHostName( host );
db->setPort( port );
if ( !db->open( user, passwd ) ) {
theData = errorMessage( i18n( "Error opening the database" ), db );
QSqlDatabase::removeDatabase( QSqlDatabase::defaultConnection );
data( QCString( theData.local8Bit() ) );
finished();
return;
}
// Show a list of tables if no table is given
if ( table == QString::null ) {
showTables( theData, db );
} else {
showTable( theData, table, db );
}
data( QCString( theData.local8Bit() ) );
finished();
}
More information about the KDevelop-devel
mailing list