openbabel/openbabel — pull request #62 by mcs07 (2014-01-15 18:44:45+00:00)
Title: Fix garbage plugin strings bug with libc++

With libc++, using OBDefine to load descriptors from plugindefines.txt would result in some plugin IDs and descriptions becoming garbage.

This was because plugins use const char* pointers for their ID and description, which point towards strings stored in a vector by OBDefine. The problem was that as new strings were read from plugindefines.txt and added to the vector, reallocations can occur to expand the vector capacity, invalidating any existing const char* created from the previously added strings using c_str().

This commit fixes this bug by reading in all descriptors from plugindefines.txt before creating the plugin instances. This ensures no changes are made to the string vector once a plugin instance has been created.