Handle the tracked voice view during destruction and isolate test startup work
This commit is contained in:
1 parent
f624fd6a75
commit
fee528194b
2 files changed
+12
-8
No files matched your search
@@ -1084,10 +1084,12 @@ void MessageDelegate::paintBody(QPainter* painter, const QStyleOptionViewItem& o
|
||||
auto* view = qobject_cast<QAbstractItemView*>(const_cast<QWidget*>(option.widget));
|
||||
if (view && s_voiceView != view) {
|
||||
s_voiceView = view;
|
||||
QObject::connect(view, &QObject::destroyed, QCoreApplication::instance(), [] {
|
||||
if (s_voiceView) return; // Уничтожен прежний view, текущий продолжает воспроизведение.
|
||||
GUI_DEBUG("voice delegate: tracking view=%p", static_cast<void*>(view));
|
||||
QObject::connect(view, &QObject::destroyed, QCoreApplication::instance(), [view] {
|
||||
if (s_voiceView && s_voiceView.data() != view) return; // Другой текущий view продолжает воспроизведение.
|
||||
s_voiceView = nullptr;
|
||||
MessageDelegate::stopAllAutoPlay();
|
||||
GUI_DEBUG("voice delegate: view destroyed, playback state released");
|
||||
GUI_DEBUG("voice delegate: view=%p destroyed, playback state released", static_cast<void*>(view));
|
||||
});
|
||||
}
|
||||
drawBubble(painter, L, option);
|
||||
|
||||
Reference in new issue
Block a user