remove public state::destroy()
parent
e644674724
commit
a2c50744da
|
@ -38,22 +38,12 @@ struct LIBCUBESCRIPT_EXPORT state {
|
||||||
virtual ~state();
|
virtual ~state();
|
||||||
|
|
||||||
state(state const &) = delete;
|
state(state const &) = delete;
|
||||||
state(state &&s) {
|
state(state &&s);
|
||||||
swap(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
state &operator=(state const &) = delete;
|
state &operator=(state const &) = delete;
|
||||||
state &operator=(state &&s) {
|
state &operator=(state &&s);
|
||||||
swap(s);
|
|
||||||
s.destroy();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroy();
|
void swap(state &s);
|
||||||
|
|
||||||
void swap(state &s) {
|
|
||||||
std::swap(p_tstate, s.p_tstate);
|
|
||||||
}
|
|
||||||
|
|
||||||
state new_thread();
|
state new_thread();
|
||||||
|
|
||||||
|
|
|
@ -266,18 +266,34 @@ state::state(alloc_func func, void *data) {
|
||||||
init_lib_base(*this);
|
init_lib_base(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBCUBESCRIPT_EXPORT state::~state() {
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
LIBCUBESCRIPT_EXPORT void state::destroy() {
|
|
||||||
|
LIBCUBESCRIPT_EXPORT state::~state() {
|
||||||
if (!p_tstate || !p_tstate->owner) {
|
if (!p_tstate || !p_tstate->owner) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto *sp = p_tstate->istate;
|
auto *sp = p_tstate->istate;
|
||||||
sp->destroy(p_tstate);
|
sp->destroy(p_tstate);
|
||||||
sp->destroy(sp);
|
sp->destroy(sp);
|
||||||
p_tstate = nullptr;
|
}
|
||||||
|
|
||||||
|
LIBCUBESCRIPT_EXPORT state::state(state &&s) {
|
||||||
|
swap(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBCUBESCRIPT_EXPORT state &state::operator=(state &&s) {
|
||||||
|
if (p_tstate && p_tstate->owner) {
|
||||||
|
auto *sp = p_tstate->istate;
|
||||||
|
sp->destroy(p_tstate);
|
||||||
|
sp->destroy(sp);
|
||||||
|
}
|
||||||
|
p_tstate = s.p_tstate;
|
||||||
|
s.p_tstate = nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBCUBESCRIPT_EXPORT void state::swap(state &s) {
|
||||||
|
std::swap(p_tstate, s.p_tstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
state::state(void *is) {
|
state::state(void *is) {
|
||||||
|
|
Loading…
Reference in New Issue