Gui: prevent native macOS color picker crash.

Fixes #25153
This commit is contained in:
pjcreath
2025-11-09 14:20:58 -05:00
committed by Chris Hennes
parent 50d22e2bb7
commit b92b54de0e
2 changed files with 12 additions and 0 deletions

View File

@@ -749,8 +749,14 @@ void ColorButton::showModal()
setColor(currentColor);
Q_EMIT changed();
}
setProperty("modal_dialog_active", false);
});
/* A FocusOut event is sent when a native macOS color picker is opened, which
* closes the editor and destroys this object. Set a property to ignore this event.
*/
setProperty("modal_dialog_active", true);
dlg->exec();
}

View File

@@ -195,6 +195,12 @@ bool PropertyItemDelegate::eventFilter(QObject *o, QEvent *ev)
}
}
else if (ev->type() == QEvent::FocusOut) {
if (auto button = qobject_cast<Gui::ColorButton*>(o)) {
// Ignore the event if the ColorButton's modal dialog is active.
if (button->property("modal_dialog_active").toBool()) {
return true;
}
}
auto parentEditor = qobject_cast<PropertyEditor*>(this->parent());
if (auto* comboBox = qobject_cast<QComboBox*>(o)) {
if (parentEditor && parentEditor->activeEditor == comboBox) {