mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
chan: fix crash when AnimControl is destroyed in threaded pipeline
See #254 for related discussion.
This commit is contained in:
parent
b72d1c198f
commit
a5beccc99e
@ -103,7 +103,7 @@ fail_anim(PartBundle *part) {
|
|||||||
*/
|
*/
|
||||||
AnimControl::
|
AnimControl::
|
||||||
~AnimControl() {
|
~AnimControl() {
|
||||||
get_part()->set_control_effect(this, 0.0f);
|
get_part()->control_removed(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -539,6 +539,25 @@ control_activated(AnimControl *control) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the AnimControl when it destructs. This needs to remove the
|
||||||
|
* AnimControl pointer from all pipeline stages.
|
||||||
|
*/
|
||||||
|
void PartBundle::
|
||||||
|
control_removed(AnimControl *control) {
|
||||||
|
nassertv(control->get_part() == this);
|
||||||
|
|
||||||
|
OPEN_ITERATE_ALL_STAGES(_cycler) {
|
||||||
|
CDStageWriter cdata(_cycler, pipeline_stage);
|
||||||
|
ChannelBlend::iterator cbi = cdata->_blend.find(control);
|
||||||
|
if (cbi != cdata->_blend.end()) {
|
||||||
|
cdata->_blend.erase(cbi);
|
||||||
|
cdata->_anim_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CLOSE_ITERATE_ALL_STAGES(_cycler);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The internal implementation of bind_anim(), this receives a pointer to an
|
* The internal implementation of bind_anim(), this receives a pointer to an
|
||||||
* uninitialized AnimControl and fills it in if the bind is successful.
|
* uninitialized AnimControl and fills it in if the bind is successful.
|
||||||
|
@ -149,6 +149,7 @@ public:
|
|||||||
// The following functions aren't really part of the public interface;
|
// The following functions aren't really part of the public interface;
|
||||||
// they're just public so we don't have to declare a bunch of friends.
|
// they're just public so we don't have to declare a bunch of friends.
|
||||||
virtual void control_activated(AnimControl *control);
|
virtual void control_activated(AnimControl *control);
|
||||||
|
void control_removed(AnimControl *control);
|
||||||
INLINE void set_update_delay(double delay);
|
INLINE void set_update_delay(double delay);
|
||||||
|
|
||||||
bool do_bind_anim(AnimControl *control, AnimBundle *anim,
|
bool do_bind_anim(AnimControl *control, AnimBundle *anim,
|
||||||
@ -204,6 +205,7 @@ private:
|
|||||||
typedef CycleDataLockedReader<CData> CDLockedReader;
|
typedef CycleDataLockedReader<CData> CDLockedReader;
|
||||||
typedef CycleDataReader<CData> CDReader;
|
typedef CycleDataReader<CData> CDReader;
|
||||||
typedef CycleDataWriter<CData> CDWriter;
|
typedef CycleDataWriter<CData> CDWriter;
|
||||||
|
typedef CycleDataStageWriter<CData> CDStageWriter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void register_with_read_factory();
|
static void register_with_read_factory();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user