UI: Fix potential race condition for hover items
The graphics thread should not be accessing any Qt objects that aren't guaranteed to exist. Instead, store the currently hovering list/preview scene items in the preview class.
This commit is contained in:
parent
7068e61fd9
commit
1b8ecae3b9
4 changed files with 25 additions and 25 deletions
|
|
@ -1270,14 +1270,21 @@ void SourceTree::dropEvent(QDropEvent *event)
|
|||
void SourceTree::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
QPoint pos = event->pos();
|
||||
SourceTreeItem *item = qobject_cast<SourceTreeItem *>
|
||||
(childAt(pos));
|
||||
SourceTreeItem *item = qobject_cast<SourceTreeItem *>(childAt(pos));
|
||||
|
||||
currentHover = item;
|
||||
OBSBasicPreview *preview = OBSBasicPreview::Get();
|
||||
preview->hoveredListItem = !!item ? item->sceneitem : nullptr;
|
||||
|
||||
QListView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void SourceTree::leaveEvent(QEvent *event)
|
||||
{
|
||||
OBSBasicPreview *preview = OBSBasicPreview::Get();
|
||||
preview->hoveredListItem = nullptr;
|
||||
QListView::leaveEvent(event);
|
||||
}
|
||||
|
||||
void SourceTree::selectionChanged(
|
||||
const QItemSelection &selected,
|
||||
const QItemSelection &deselected)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue