src: Various fixes from testing

* fixed deleted project could still be selected in the recent project menu
* fixed project file not loaded when declining for reload
* fixed main in tutorial description not clickable
* fixed clang warnings
* fixed commands not showing up in autocompletion
* fixed classes were expanded when activating aggregation
* fixed crash when messagelisteners tried to unregister after messagequeue was destructed
This commit is contained in:
Eberhard Graether
2016-04-25 17:27:20 +02:00
parent e17c42b2ef
commit f9aed67776
12 changed files with 32 additions and 18 deletions
@@ -19,8 +19,11 @@ public:
virtual ~MessageListenerBase()
{
if (m_alive)
{
MessageQueue::getInstance()->unregisterListener(this);
}
m_alive = false;
MessageQueue::getInstance()->unregisterListener(this);
}
uint getId() const
@@ -45,6 +48,11 @@ public:
}
}
void removedListener()
{
m_alive = false;
}
private:
virtual std::string doGetType() const = 0;
virtual void doHandleMessageBase(MessageBase*) = 0;
+6 -1
View File
@@ -20,7 +20,12 @@ std::shared_ptr<MessageQueue> MessageQueue::getInstance()
MessageQueue::~MessageQueue()
{
// TODO: remove remaining listeners. And tell them that they shouldn't unregister anymore.
std::lock_guard<std::mutex> lock(m_listenersMutex);
for (size_t i = 0; i < m_listeners.size(); i++)
{
m_listeners[i]->removedListener();
}
m_listeners.clear();
}
void MessageQueue::registerListener(MessageListenerBase* listener)