Commit 0274f177 authored by Halla Rempt's avatar Halla Rempt
Browse files

Fix crash in kis_multi_integer_widget

See http://krita-breakpad.kogmbh.net:1127/view/c6f946ff-e0e5-43bc-8642-479460c485fd

 0  0x0
    rbx = 0x00000032b6b19770   r12 = 0x00000032dc0d4c20
    r13 = 0x000000329225abe0   r14 = 0x0000000000000000
    r15 = 0x0000000000000001   rip = 0x0000000000000000
    rsp = 0x000000328eb5b798   rbp = 0x00000032dc0d4c20
    Found by: given as instruction pointer in context
 1  kritaui.dll!KisMultiIntegerFilterWidget::configuration() [kis_multi_integer_filter_widget.cc : 116 + 0x43]
    rip = 0x000007fa4e3049a3   rsp = 0x000000328eb5b7a0
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 2  ntdll.dll + 0x5740
    rip = 0x000007fa6d615740   rsp = 0x000000328eb5b7b0
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 3  kritaui.dll!@ILT+24385(??_EKisDelayedActionDoubleInput@@WBA@EAAPEAXI@Z) + 0x5
    rip = 0x000007fa4e156f4b   rsp = 0x000000328eb5b7e8
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 4  kritaui.dll!KisFilterSelectorWidget::configuration() [kis_filter_selector_widget.cc : 225 + 0x9]
    rip = 0x000007fa4e2faead   rsp = 0x000000328eb5b7f0
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 5  ntdll.dll + 0x5740
    rip = 0x000007fa6d615740   rsp = 0x000000328eb5b820
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 6  kritaui.dll!KisDlgFilter::updatePreview() [kis_dlg_filter.cpp : 117 + 0xd]
    rip = 0x000007fa4e1a0dde   rsp = 0x000000328eb5b830
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 7  QtGui4.dll + 0x331839
    rip = 0x00000000603d1839   rsp = 0x000000328eb5b880
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 8  kritaui.dll!@ILT+24385(??_EKisDelayedActionDoubleInput@@WBA@EAAPEAXI@Z) + 0x5
    rip = 0x000007fa4e156f4b   rsp = 0x000000328eb5b888
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
 9  kritaui.dll!KisDlgFilter::previewCheckBoxChange(int) [kis_dlg_filter.cpp : 170 + 0x5]
    rip = 0x000007fa4e1a001b   rsp = 0x000000328eb5b890
    rbp = 0x00000032dc0d4c20
    Found by: stack scanning
parent 8b17d11d
......@@ -60,48 +60,55 @@ KisIntegerWidgetParam::KisIntegerWidgetParam(qint32 nmin, qint32 nmax, qint32 ni
{
}
KisMultiIntegerFilterWidget::KisMultiIntegerFilterWidget(const QString & filterid, QWidget * parent,
const QString & caption,
KisMultiIntegerFilterWidget::KisMultiIntegerFilterWidget(const QString& filterid,
QWidget* parent,
const QString& caption,
vKisIntegerWidgetParam iwparam)
: KisConfigWidget(parent)
, m_filterid(filterid)
, m_config(new KisFilterConfiguration(filterid, 0))
{
m_nbintegerWidgets = iwparam.size();
this->setWindowTitle(caption);
QGridLayout *widgetLayout = new QGridLayout(this);
widgetLayout->setColumnStretch(1, 1);
m_integerWidgets = new KisDelayedActionIntegerInput*[ m_nbintegerWidgets ];
for (uint i = 0; i < iwparam.size(); ++i) {
KisDelayedActionIntegerInput *widget = new KisDelayedActionIntegerInput(this, iwparam[i].name);
for (qint32 i = 0; i < m_nbintegerWidgets; ++i) {
m_integerWidgets[i] = new KisDelayedActionIntegerInput(this, iwparam[i].name);
m_integerWidgets[i]->setRange(iwparam[i].min, iwparam[i].max);
m_integerWidgets[i]->setValue(iwparam[i].initvalue);
m_integerWidgets[i]->cancelDelayedSignal();
widget->setRange(iwparam[i].min, iwparam[i].max);
widget->setValue(iwparam[i].initvalue);
widget->cancelDelayedSignal();
connect(m_integerWidgets[i], SIGNAL(valueChangedDelayed(int)), SIGNAL(sigConfigurationItemChanged()));
connect(widget, SIGNAL(valueChangedDelayed(int)), SIGNAL(sigConfigurationItemChanged()));
QLabel* lbl = new QLabel(iwparam[i].label + ':', this);
widgetLayout->addWidget(lbl, i , 0);
widgetLayout->addWidget(m_integerWidgets[i], i , 1);
widgetLayout->addWidget(widget, i , 1);
m_integerWidgets.append(widget);
}
QSpacerItem * sp = new QSpacerItem(1, 1);
widgetLayout->addItem(sp, m_nbintegerWidgets, 0);
widgetLayout->addItem(sp, iwparam.size(), 0);
}
KisMultiIntegerFilterWidget::~KisMultiIntegerFilterWidget()
{
delete m_config;
}
void KisMultiIntegerFilterWidget::setConfiguration(const KisPropertiesConfiguration* config)
{
if (!config) return;
if (!m_config) {
m_config = new KisFilterConfiguration(m_filterid, 0);
}
m_config->fromXML(config->toXML());
for (int i = 0; i < nbValues(); ++i) {
KisDelayedActionIntegerInput * w = m_integerWidgets[i];
KisDelayedActionIntegerInput* w = m_integerWidgets[i];
if (w) {
int val = config->getInt(m_integerWidgets[i]->objectName());
m_integerWidgets[i]->setValue(val);
......@@ -112,10 +119,33 @@ void KisMultiIntegerFilterWidget::setConfiguration(const KisPropertiesConfigurat
KisPropertiesConfiguration* KisMultiIntegerFilterWidget::configuration() const
{
KisFilterConfiguration *config = new KisFilterConfiguration(m_filterid, 0);
if (m_config) {
config->fromXML(m_config->toXML());
}
for (int i = 0; i < nbValues(); ++i) {
m_config->setProperty(m_integerWidgets[i]->objectName(), m_integerWidgets[i]->value());
KisDelayedActionIntegerInput* w = m_integerWidgets[i];
if (w) {
config->setProperty(w->objectName(), w->value());
}
}
return config;
}
qint32 KisMultiIntegerFilterWidget::nbValues() const {
return m_integerWidgets.size();
}
qint32 KisMultiIntegerFilterWidget::valueAt(qint32 i) {
if (i < m_integerWidgets.size()) {
return m_integerWidgets[i]->value();
}
else {
warnKrita << "Trying to access integer widget" << i << "but there are only" << m_integerWidgets.size() << "widgets";
return 0;
}
return m_config;
}
#include "kis_multi_integer_filter_widget.moc"
......@@ -22,6 +22,8 @@
#include <knuminput.h>
#include <kis_config_widget.h>
#include "krita_export.h"
#include <kis_debug.h>
#include <QVector>
#include <vector>
......@@ -47,7 +49,7 @@ private:
struct KRITAUI_EXPORT KisIntegerWidgetParam {
KisIntegerWidgetParam(qint32 nmin, qint32 nmax, qint32 ninitvalue, const QString & label, const QString & nname);
KisIntegerWidgetParam(qint32 nmin, qint32 nmax, qint32 ninitvalue, const QString& label, const QString& nname);
qint32 min;
qint32 max;
......@@ -62,22 +64,18 @@ class KRITAUI_EXPORT KisMultiIntegerFilterWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisMultiIntegerFilterWidget(const QString & filterid, QWidget * parent, const QString & caption, vKisIntegerWidgetParam iwparam);
KisMultiIntegerFilterWidget(const QString& filterid, QWidget* parent, const QString& caption, vKisIntegerWidgetParam iwparam);
~KisMultiIntegerFilterWidget();
virtual void setConfiguration(const KisPropertiesConfiguration* config);
virtual KisPropertiesConfiguration* configuration() const;
public:
inline qint32 nbValues() const {
return m_nbintegerWidgets;
}
inline qint32 valueAt(qint32 i) {
return m_integerWidgets[i]->value();
}
private:
qint32 m_nbintegerWidgets;
KisDelayedActionIntegerInput** m_integerWidgets;
qint32 nbValues() const;
qint32 valueAt(qint32 i);
QVector<KisDelayedActionIntegerInput*> m_integerWidgets;
QString m_filterid;
KisPropertiesConfiguration* m_config;
};
......
Supports Markdown
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