Skip to content

Commit

Permalink
Merge pull request #234 from dkoes/pluginfix
Browse files Browse the repository at this point in the history
fix for segfaulting similarity search with fastsearch index
  • Loading branch information
ghutchis committed Dec 29, 2015
2 parents b83b71b + 493c7ce commit a664de0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/openbabel/plugin.h
Expand Up @@ -124,6 +124,9 @@ class OBERROR OBPlugin
///Returns the map of the subtypes
virtual PluginMapType& GetMap() const =0;

///Load all plugins (formats, fingerprints, forcefields etc.)
static void LoadAllPlugins();

protected:
///\brief Returns a reference to the map of the plugin types.
/// Is a function rather than a static member variable to avoid initialization problems.
Expand All @@ -136,9 +139,6 @@ class OBERROR OBPlugin
///Keep a record if all plugins have been loaded
static int AllPluginsLoaded;

///Load all plugins (formats, fingerprints, forcefields etc.)
static void LoadAllPlugins();

///Returns the map of a particular plugin type, e.g. GetMapType("fingerprints")
static PluginMapType& GetTypeMap(const char* PluginID);

Expand Down
7 changes: 7 additions & 0 deletions src/formats/fastsearchformat.cpp
Expand Up @@ -541,6 +541,13 @@ virtual const char* Description() //required
vector<string> vec;
tokenize(vec, p);

if(vec.size() == 0)
{
obErrorLog.ThrowError(__FUNCTION__,
"Missing argument for -s/-S", obError);
return false;
}

//ignore leading ~ (not relevant to fastsearch)
if(vec[0][0]=='~')
vec[0].erase(0,1);
Expand Down
3 changes: 3 additions & 0 deletions tools/babel.cpp
Expand Up @@ -73,6 +73,9 @@ int main(int argc,char *argv[])
char *oext = NULL;
char *iext = NULL;

//load plugs to fully initialize option parameters
OBPlugin::LoadAllPlugins();

//Save name of program without its path (and .exe)
string pn(argv[0]);
string::size_type pos;
Expand Down

0 comments on commit a664de0

Please sign in to comment.