1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Linux: Use list instead of vector for file descriptor callback storage in internal message queue to fix issues when recursively adding or removing callbacks

This commit is contained in:
ed 2020-03-06 16:26:32 +00:00
parent 72c1914004
commit c47c790f79
2 changed files with 3 additions and 5 deletions

View file

@ -59,6 +59,7 @@
#include <mutex>
#include <condition_variable>
#include <queue>
#include <list>
//==============================================================================
#include "juce_CompilerSupport.h"

View file

@ -112,10 +112,7 @@ JUCE_IMPLEMENT_SINGLETON (InternalMessageQueue)
struct InternalRunLoop
{
public:
InternalRunLoop()
{
fdReadCallbacks.reserve (8);
}
InternalRunLoop() = default;
void registerFdCallback (int fd, std::function<void(int)>&& cb, short eventMask)
{
@ -186,7 +183,7 @@ public:
private:
CriticalSection lock;
std::vector<std::pair<int, std::function<void(int)>>> fdReadCallbacks;
std::list<std::pair<int, std::function<void(int)>>> fdReadCallbacks;
std::vector<pollfd> pfds;
};