PCloudStimBuff: Call stop=>start in destroyAttachedStimBuff
This ensures that we can avoid races when adding and removing stimbuffs to a stimproducer. At least in theory. I can think of some ways in which this current design may result in races or other bad conditions.
This commit is contained in:
@@ -210,6 +210,8 @@ void PcloudStimulusProducer::destroyAttachedStimulusBuffer(
|
|||||||
{
|
{
|
||||||
if (!buffer) { return; }
|
if (!buffer) { return; }
|
||||||
|
|
||||||
|
this->stop();
|
||||||
|
|
||||||
// Clear specialized buffer pointers if they match
|
// Clear specialized buffer pointers if they match
|
||||||
if (meshStimulusBuffer == buffer)
|
if (meshStimulusBuffer == buffer)
|
||||||
{ meshStimulusBuffer.reset(); }
|
{ meshStimulusBuffer.reset(); }
|
||||||
@@ -220,6 +222,8 @@ void PcloudStimulusProducer::destroyAttachedStimulusBuffer(
|
|||||||
|
|
||||||
// Call base class implementation to remove from attachedStimulusBuffers
|
// Call base class implementation to remove from attachedStimulusBuffers
|
||||||
StimulusProducer::destroyAttachedStimulusBuffer(buffer);
|
StimulusProducer::destroyAttachedStimulusBuffer(buffer);
|
||||||
|
|
||||||
|
this->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<StimulusBuffer>
|
std::shared_ptr<StimulusBuffer>
|
||||||
|
|||||||
Reference in New Issue
Block a user