mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 22:49:37 -05:00
added checks in Plugin system to avoid core dumping when no plugins are found
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@978 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
71d7671564
commit
2fd0e95128
@ -118,27 +118,39 @@ PluginsPage::PluginsPage(QWidget *parent )
|
||||
QRegExp rx_qs(".*js");
|
||||
|
||||
ti = scfList.indexOf(rx_qs);
|
||||
QFile scriptFile( spDir.absoluteFilePath( scfList.at(ti) ) );
|
||||
scriptFile.open(QIODevice::ReadOnly);
|
||||
engine->evaluate(scriptFile.readAll());
|
||||
scriptFile.close();
|
||||
|
||||
if(ti > -1)
|
||||
{
|
||||
QFile scriptFile( spDir.absoluteFilePath( scfList.at(ti) ) );
|
||||
scriptFile.open(QIODevice::ReadOnly);
|
||||
engine->evaluate(scriptFile.readAll());
|
||||
scriptFile.close();
|
||||
}
|
||||
|
||||
QUiLoader loader;
|
||||
QRegExp rx_ui(".*ui");
|
||||
ti = scfList.indexOf(rx_ui) ;
|
||||
QFile uiFile( spDir.absoluteFilePath( scfList.at(ti) ) );
|
||||
qDebug() << "ui file is " << scfList.at(ti) ;
|
||||
uiFile.open(QIODevice::ReadOnly);
|
||||
|
||||
QWidget *ui = loader.load(&uiFile);
|
||||
uiFile.close();
|
||||
QWidget *ui = NULL ;
|
||||
|
||||
QScriptValue ctor = engine->evaluate("Plugin");
|
||||
QScriptValue scriptUi = engine->newQObject(ui, QScriptEngine::ScriptOwnership);
|
||||
QScriptValue calc = ctor.construct(QScriptValueList() << scriptUi);
|
||||
if(ti > -1)
|
||||
{
|
||||
ti = scfList.indexOf(rx_ui) ;
|
||||
QFile uiFile( spDir.absoluteFilePath( scfList.at(ti) ) );
|
||||
qDebug() << "ui file is " << scfList.at(ti) ;
|
||||
uiFile.open(QIODevice::ReadOnly);
|
||||
|
||||
ui = loader.load(&uiFile);
|
||||
uiFile.close();
|
||||
}
|
||||
|
||||
if (!ui)
|
||||
qDebug() << "ui is null :(" ;
|
||||
else
|
||||
{
|
||||
QScriptValue ctor = engine->evaluate("Plugin");
|
||||
QScriptValue scriptUi = engine->newQObject(ui, QScriptEngine::ScriptOwnership);
|
||||
QScriptValue calc = ctor.construct(QScriptValueList() << scriptUi);
|
||||
}
|
||||
|
||||
|
||||
//ui->show();
|
||||
pluginTabs->addTab(ui,"Script plugin");
|
||||
|
Loading…
Reference in New Issue
Block a user