Skip to content

Commit

Permalink
Avoid using an empty paraview.path.
Browse files Browse the repository at this point in the history
It causes a segfault on Linux/OS X if it is empty.
Refs #10740
  • Loading branch information
martyngigg committed Dec 10, 2014
1 parent 72e8ac2 commit 119bb21
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Expand Up @@ -252,16 +252,18 @@ void MdViewerWidget::createAppCoreForPlugin()
if (!pqApplicationCore::instance())
{
// Provide ParaView's application core with a path to ParaView
int argc = 1;

std::string paraviewPath = Mantid::Kernel::ConfigService::Instance().getParaViewPath();
if(paraviewPath.empty())
{
// ParaView crashes with an empty string but on Linux/OSX we dont set this property
paraviewPath = "/tmp/MantidPlot";
}
std::vector<char> argvConversion(paraviewPath.begin(), paraviewPath.end());
argvConversion.push_back('\0');

int argc = 1;
char *argv[] = {&argvConversion[0]};

g_log.debug() << "Intialize pqApplicationCore with " << argv << "\n";

new pqPVApplicationCore(argc, argv);
}
else
Expand Down
Expand Up @@ -43,21 +43,25 @@ ThreeSliceView::ThreeSliceView(QWidget *parent) : ViewBase(parent)
{
this->ui.setupUi(this);

// We need to load the QuadView.dll plugin. The Windows system requires the full
// We need to load the QuadView plugin
QString quadViewLibrary;
#ifdef Q_OS_WIN32
// Windows requires the full
// path information. The DLL is located in the apropriate executeable path of paraview.
const Poco::Path paraviewPath(Mantid::Kernel::ConfigService::Instance().getParaViewPath());

Poco::Path quadViewFullPath(paraviewPath, QUADVIEW_LIBRARY.toStdString());

QString quadViewLibrary(quadViewFullPath.toString().c_str());
quadViewLibrary = quadViewFullPath.toString().c_str();
#else
quadViewLibrary = QUADVIEW_LIBRARY;
#endif

// Need to load plugin
pqPluginManager* pm = pqApplicationCore::instance()->getPluginManager();
QString error;
pm->loadExtension(pqActiveObjects::instance().activeServer(),
quadViewLibrary, &error, false);

g_log.debug() << "Loading QuadView.dll from " << quadViewLibrary.toStdString() << "\n";
g_log.debug() << "Loading QuadView library from " << quadViewLibrary.toStdString() << "\n";

this->mainView = this->createRenderView(this->ui.mainRenderFrame,
QString("pqQuadView"));
Expand Down

0 comments on commit 119bb21

Please sign in to comment.