Hopefully this stops any crashes around QuickActions.qml and EmojiDialog.qml
Hopefully this stops any crashes around QuickActions.qml and EmojiDialog.qml. Best I can guess this is some race condition where QuickActions are deleted in the time it takes to instnatiate the EmojiDialog popup. I've also rearranged the updateQuickActions function to stop a possible race condition there. BUG: 509484
This commit is contained in:
committed by
Tobias Fella
parent
1070427a0d
commit
7356a68f4c
@@ -33,6 +33,7 @@ RowLayout {
|
|||||||
icon.name: "preferences-desktop-emoticons"
|
icon.name: "preferences-desktop-emoticons"
|
||||||
display: QQC2.ToolButton.IconOnly
|
display: QQC2.ToolButton.IconOnly
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
root.reacting = true;
|
||||||
var dialog = emojiDialog.createObject(reactButton);
|
var dialog = emojiDialog.createObject(reactButton);
|
||||||
dialog.chosen.connect(emoji => {
|
dialog.chosen.connect(emoji => {
|
||||||
root.reacting = false;
|
root.reacting = false;
|
||||||
@@ -44,7 +45,6 @@ RowLayout {
|
|||||||
dialog.closed.connect(() => {
|
dialog.closed.connect(() => {
|
||||||
root.reacting = false;
|
root.reacting = false;
|
||||||
})
|
})
|
||||||
root.reacting = true;
|
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,10 @@ qreal MessageDelegateBase::maxContentWidth() const
|
|||||||
|
|
||||||
void MessageDelegateBase::cleanupIncubator(MessageObjectIncubator *incubator)
|
void MessageDelegateBase::cleanupIncubator(MessageObjectIncubator *incubator)
|
||||||
{
|
{
|
||||||
|
if (!incubator) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
incubator->clear();
|
incubator->clear();
|
||||||
const auto it = std::find(m_activeIncubators.begin(), m_activeIncubators.end(), incubator);
|
const auto it = std::find(m_activeIncubators.begin(), m_activeIncubators.end(), incubator);
|
||||||
if (it != m_activeIncubators.end()) {
|
if (it != m_activeIncubators.end()) {
|
||||||
@@ -471,35 +475,40 @@ void MessageDelegateBase::setQuickActionComponent(QQmlComponent *quickActionComp
|
|||||||
|
|
||||||
void MessageDelegateBase::updateQuickAction()
|
void MessageDelegateBase::updateQuickAction()
|
||||||
{
|
{
|
||||||
if (m_quickActionComponent && !m_compactMode && m_hovered && !m_quickActionItem && !m_quickActionIncubating) {
|
if (!m_hovered || m_compactMode) {
|
||||||
const auto quickActionIncubator = new MessageObjectIncubator(
|
if (m_quickActionItem && (!m_quickActionItem->property("reacting").toBool() || m_compactMode)) {
|
||||||
m_objectInitialCallback,
|
cleanupItem(m_quickActionItem);
|
||||||
[this](MessageObjectIncubator *incubator) {
|
markAsDirty();
|
||||||
if (!incubator) {
|
}
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
const auto quickActionObject = qobject_cast<QQuickItem *>(incubator->object());
|
|
||||||
if (quickActionObject) {
|
|
||||||
if (!m_compactMode) {
|
|
||||||
m_quickActionItem = quickActionObject;
|
|
||||||
connect(m_quickActionItem, SIGNAL(reactingChanged()), this, SLOT(updateQuickAction()));
|
|
||||||
} else {
|
|
||||||
cleanupItem(quickActionObject);
|
|
||||||
}
|
|
||||||
markAsDirty();
|
|
||||||
}
|
|
||||||
m_quickActionIncubating = false;
|
|
||||||
cleanupIncubator(incubator);
|
|
||||||
},
|
|
||||||
m_errorCallback);
|
|
||||||
m_activeIncubators.push_back(quickActionIncubator);
|
|
||||||
m_quickActionComponent->create(*quickActionIncubator, qmlContext(m_quickActionComponent));
|
|
||||||
m_quickActionIncubating = true;
|
|
||||||
} else if (m_quickActionItem && !m_hovered && !m_quickActionItem->property("reacting").toBool()) {
|
|
||||||
cleanupItem(m_quickActionItem);
|
|
||||||
markAsDirty();
|
|
||||||
}
|
}
|
||||||
|
if (!m_quickActionComponent || m_quickActionItem || m_quickActionIncubating) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_quickActionIncubating = true;
|
||||||
|
const auto quickActionIncubator = new MessageObjectIncubator(
|
||||||
|
m_objectInitialCallback,
|
||||||
|
[this](MessageObjectIncubator *incubator) {
|
||||||
|
if (!incubator) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (const auto quickActionObject = qobject_cast<QQuickItem *>(incubator->object())) {
|
||||||
|
if (!m_compactMode) {
|
||||||
|
m_quickActionItem = quickActionObject;
|
||||||
|
connect(m_quickActionItem, SIGNAL(reactingChanged()), this, SLOT(updateQuickAction()));
|
||||||
|
} else {
|
||||||
|
cleanupItem(quickActionObject);
|
||||||
|
}
|
||||||
|
markAsDirty();
|
||||||
|
}
|
||||||
|
cleanupIncubator(incubator);
|
||||||
|
m_quickActionIncubating = false;
|
||||||
|
},
|
||||||
|
m_errorCallback);
|
||||||
|
m_activeIncubators.push_back(quickActionIncubator);
|
||||||
|
m_quickActionComponent->create(*quickActionIncubator, qmlContext(m_quickActionComponent));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessageDelegateBase::showLocalMessagesOnRight() const
|
bool MessageDelegateBase::showLocalMessagesOnRight() const
|
||||||
|
|||||||
Reference in New Issue
Block a user