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

Fixing UB whil registering polymorphic classes for serialization #1520

Merged
merged 1 commit into from May 19, 2015
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
Expand Up @@ -68,10 +68,9 @@ namespace hpx { namespace serialization { namespace detail
{
register_class_name()
{
T* t = 0; //dirty
polymorphic_intrusive_factory::instance().
register_class(
t->T::hpx_serialization_get_name(), //non-virtual call
T::hpx_serialization_get_name_impl(),
&factory_function
);
}
Expand All @@ -98,12 +97,16 @@ namespace hpx { namespace serialization { namespace detail
template <class> friend \
struct ::hpx::serialization::detail::register_class_name; \
\
virtual std::string hpx_serialization_get_name() const \
static std::string hpx_serialization_get_name_impl() \
{ \
hpx::serialization::detail::register_class_name< \
Class>::instance.instantiate(); \
return Name; \
} \
virtual std::string hpx_serialization_get_name() const \
{ \
return Class ::hpx_serialization_get_name_impl(); \
} \
/**/

#define HPX_SERIALIZATION_POLYMORPHIC_WITH_NAME(Class, Name) \
Expand Down