Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfaults in add-on tests #6151

Merged
merged 1 commit into from Nov 1, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion FWCore/Utilities/src/TypeWithDict.cc
Expand Up @@ -124,6 +124,10 @@ namespace edm {
}
}

if(name == "void") {
return TypeWithDict(typeid(void), property);
}

TEnum* theEnum = TEnum::GetEnum(name.c_str(), TEnum::kAutoload);
if(theEnum) {
return TypeWithDict(theEnum, name, property);
Expand Down Expand Up @@ -268,6 +272,9 @@ namespace edm {
// Must be a class, struct, or union.
class_ = TClass::GetClass(*ti_);
}
if (gInterpreter->Type_IsEnum(ttype)) {
enum_ = TEnum::GetEnum(*ti_, TEnum::kAutoload);
}
}

TypeWithDict::operator bool() const {
Expand All @@ -283,6 +290,10 @@ namespace edm {

std::type_info const&
TypeWithDict::typeInfo() const {
if(isEnum() && *ti_ == typeid(int)) {
TType* ttype = gInterpreter->Type_Factory(name());
return *gInterpreter->Type_TypeInfo(ttype);
}
return *ti_;
}

Expand Down Expand Up @@ -414,7 +425,7 @@ namespace edm {

std::string
TypeWithDict::name() const {
if(enum_ != nullptr) {
if(enum_ != nullptr && *ti_ == typeid(int)) {
return std::string(enum_->GetClass()->GetName()) + "::" + enum_->GetName();
}
return TypeID(*ti_).className();
Expand Down