Closed
Description
I would like to have your opinion on the following. Is it an issue?
Note: I haven't tried to make the following situation happens. At this point, I just suspect this is an issue.
Following is a series of steps leading to the suspected issue:
- Application Thread calls:
inline int pollEndOfStreams(F&& endOfStreamHandler)
{
const ImageList * imageList = std::atomic_load_explicit(&m_imageList, std::memory_order_acquire);
Application Thread is somehow interrupted...
- Conductor Thread calls:
Subscription::removeImage/addImage
Because it executes the following code: newArray[j++] = std::move(oldArray[i]);
which calls: m_logBuffers = std::move(image.m_logBuffers);
imageList now contains at least one image where image.m_logBuffers is nullptr.
- Application Thread resumes its execution of pollEndOfStreams
const std::size_t length = imageList->m_length;
Image *images = imageList->images();
int numEndOfStreams = 0;
for (std::size_t i = 0; i < length; i++)
{
if (images[i].isEndOfStream()) // **<<< This would crash because m_logBuffers is nullptr**
{
numEndOfStreams++;
endOfStreamHandler(images[i]);
}
}
return numEndOfStreams;
}
Metadata
Metadata
Assignees
Labels
No labels