Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUG: Disable ITK_AUTOLOAD_PATH/itkMRMLIDIOPlugin for executable CLIs

Unset ITK_AUTOLOAD_PATH environment variable to prevent the CLI from
loading the itkMRMLIDIOPlugin plugin because executable CLIs read images
from file and not from shared memory. Worst the plugin in the CLI
could clash by loading libraries (ITK, VTK, MRML) other than the
statically linked to the executable.
Historically, there was an nvidia driver bug that causes the module
to fail on exit with undefined symbol.

Regression from r12053 (always broken in Slicer4, works in Slicer3)

Issues #2773 #1635

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21440 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
commit e3476fb63e3c6283d45c60c61f65a9d945a4544d 1 parent 5ca85f3
@finetjul finetjul authored
Showing with 27 additions and 4 deletions.
  1. +27 −4 Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
View
31 Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
@@ -1351,8 +1351,24 @@ void vtkSlicerCLIModuleLogic::ApplyTask(void *clientdata)
{
// Run as a command line module
//
- //
-
+ //
+
+ // Unset ITK_AUTOLOAD_PATH environment variable to prevent the CLI from
+ // loading the itkMRMLIDIOPlugin plugin because executable CLIs read images
+ // from file and not from shared memory. Worst the plugin in the CLI
+ // could clash by loading libraries (ITK, VTK, MRML) other than the
+ // statically linked to the executable.
+ // Historically, there was an nvidia driver bug that causes the module
+ // to fail on exit with undefined symbol.
+ std::string saveITKAutoLoadPath;
+ itksys::SystemTools::GetEnv("ITK_AUTOLOAD_PATH", saveITKAutoLoadPath);
+ std::string emptyString("ITK_AUTOLOAD_PATH=");
+ int putSuccess =
+ itksys::SystemTools::PutEnv(const_cast <char *> (emptyString.c_str()));
+ if (!putSuccess)
+ {
+ vtkErrorMacro( "Unable to reset ITK_AUTOLOAD_PATH.");
+ }
//
// now run the process
//
@@ -1368,10 +1384,17 @@ void vtkSlicerCLIModuleLogic::ApplyTask(void *clientdata)
// execute the command
itksysProcess_Execute(process);
-
// restore the load path
-
+ std::string putEnvString = ("ITK_AUTOLOAD_PATH=");
+ putEnvString = putEnvString + saveITKAutoLoadPath;
+ putSuccess =
+ itksys::SystemTools::PutEnv(const_cast <char *> (putEnvString.c_str()));
+ if (!putSuccess)
+ {
+ vtkErrorMacro( "Unable to restore ITK_AUTOLOAD_PATH. ");
+ }
+
// Wait for the command to finish
char *tbuffer;
int length;
Please sign in to comment.
Something went wrong with that request. Please try again.