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

boost serialization can not be sc stoped in windows platform #283

Closed
gucoi opened this issue May 19, 2023 · 3 comments
Closed

boost serialization can not be sc stoped in windows platform #283

gucoi opened this issue May 19, 2023 · 3 comments

Comments

@gucoi
Copy link

gucoi commented May 19, 2023

i use boost serialization like below, but the class definition in the DLL, and exe used for communication between two ends, but when i use the sc stop to shutdown my windows exe, it throw a abort, like below this, i check the stack, not found my code in this.

struct base {
    virtual std::string get_name () {
        return STRUCT_STR(base);
    }
    template<class Archive>
    void serialize(Archive &ar, const int version) {
    }
};

struct A : public base {
    virtual std::string get_name () {
        return STRUCT_STR(A);
    }
    template<class Archive>
    void serialize(Archive &ar, const int version) {
        ar & boost::serialization::base_object<base>(*this);
    }
};

struct B : public A {
    B(int _e) {e = _e;}
    B() {}
    virtual std::string get_name () {
        std::cout << e;
        return STRUCT_STR(B);
    }

    template<class Archive>
    void serialize(Archive &ar, const int version) {
        ar & boost::serialization::base_object<A>(*this);
        ar & e;
        ar & p;
    }

    int e;
    ProcessStatus p = UNINITIALIZED;
};

void register_oa_class_type(boost::archive::text_oarchive& oa) {
    oa.register_type<base>();
    oa.register_type<A>();
    oa.register_type<B>();
}

void register_ia_class_type(boost::archive::text_iarchive& ia) {
    ia.register_type<base>();
    ia.register_type<A>();
    ia.register_type<B>();
}

abort

boost::serialization::singleton<std::set<boost::serialization::void_cast_detail::void_caster const * __ptr64,boost::serialization::void_cast_detail::void_caster_compare,std::allocator<boost::serialization::void_cast_detail::void_caster const * __ptr64> > >::is_destroyed

i don't know it is a issue or not, but in the linux platform, so -> binary, it's not found this question, if you have any answer about the this question or special usage in windows.

Thanks very much.

@gucoi
Copy link
Author

gucoi commented May 19, 2023

my boost version is the 1.79.0, windows is the AMD64

@mclow mclow transferred this issue from boostorg/boost May 19, 2023
@robertramey
Copy link
Member

Is this still a problem? If so, please include a freestanding test which illustrates the problem. Given what you've written above, this should not be difficult

@robertramey
Copy link
Member

fixed and merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants