提交 0a202ab7 编写于 作者: J jp9000

UI: Fix potential race condition

The signal mutex can be locked within other signal mutexes, causing a
potential hard cross-lock when releasing certain sources.  Instead,
defer the Disconnect() call to the UI thread.

This fixes a potential freeze on exit.
上级 a88b4402
......@@ -129,6 +129,12 @@ void SourceTreeItem::DisconnectSignals()
removeSignal.Disconnect();
}
void SourceTreeItem::Clear()
{
DisconnectSignals();
sceneitem = nullptr;
}
void SourceTreeItem::ReconnectSignals()
{
if (!sceneitem)
......@@ -150,10 +156,8 @@ void SourceTreeItem::ReconnectSignals()
Q_ARG(OBSSceneItem, curItem));
curItem = nullptr;
}
if (!curItem) {
this_->DisconnectSignals();
this_->sceneitem = nullptr;
}
if (!curItem)
QMetaObject::invokeMethod(this_, "Clear");
};
auto itemVisible = [] (void *data, calldata_t *cd)
......
......@@ -72,6 +72,8 @@ private:
virtual void paintEvent(QPaintEvent* event) override;
private slots:
void Clear();
void EnterEditMode();
void ExitEditMode(bool save);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册