Commit f138e606 authored by Agata Cacko's avatar Agata Cacko

Fix crash from ProxyStyle in KisColorFilterCombo

Before this commit, if the KisColorFilterCombo was used in a widget that
gets deleted when the canvas gets deleted, Krita would crash because
the ain (shared) style was supplied to create a proxy style for the
color filter combobox, hence the main style would be deleted before
Krita closes. This commit creates a new style and gives the proxy style
the new one.

Note: giving a null wouldn't work, because then on systems where the
main style is different from the list that Krita allows, it would look
wrong. For example I have a light mode on my Cinnamon, it's called
Mint-X or something similar, and giving a null would mean that the whole
program is dark, using fusion style, and "Krita dark" theme, and this
one combobox would use native style, meaning Mint-X, and being very
light and not fitting the rest of Krita.
parent ae915410
......@@ -29,6 +29,7 @@
#include <QListView>
#include <QMouseEvent>
#include <QStyleFactory>
......@@ -190,7 +191,10 @@ KisColorFilterCombo::KisColorFilterCombo(QWidget *parent)
QStandardItemModel *newModel = new QStandardItemModel(this);
setModel(newModel);
PopupComboBoxStyle *proxyStyle = new PopupComboBoxStyle(style());
QStyle* newStyle = QStyleFactory::create(style()->objectName());
// proxy style steals the ownership of the style and deletes it later
PopupComboBoxStyle *proxyStyle = new PopupComboBoxStyle(newStyle);
proxyStyle->setParent(this);
setStyle(proxyStyle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment