|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Fix crash when selecting a shiva filter or generatorhi,
Those two patches fixes crashes when selecting some of the shiva filters that have already been used, and also when reconfiguring some of the generators. I would like to backport them to branch/2.1. -- Cyrille Berger [fix-shiva-reselect-some-generator.diff] Index: krita/plugins/extensions/shiva/ShivaGeneratorConfigWidget.cpp =================================================================== --- krita/plugins/extensions/shiva/ShivaGeneratorConfigWidget.cpp (revision 1047123) +++ krita/plugins/extensions/shiva/ShivaGeneratorConfigWidget.cpp (working copy) @@ -42,7 +42,10 @@ for (QMap<QString, QVariant>::iterator it = map.begin(); it != map.end(); ++it) { const GTLCore::Metadata::Entry* entry = m_source->metadata()->parameter(it.key().toAscii().data()); if (entry and entry->asParameterEntry()) { - m_widget->setParameter(it.key().toAscii().data(), qvariantToValue(it.value(), entry->asParameterEntry()->valueType())); + GTLCore::Value val = qvariantToValue(it.value(), entry->asParameterEntry()->valueType()); + if (val.isValid()) { + m_widget->setParameter(it.key().toAscii().data(), val); + } } } } [fix-shiva-reapply-vector.diff] Index: krita/plugins/extensions/shiva/shivafilter.cpp =================================================================== --- krita/plugins/extensions/shiva/shivafilter.cpp (revision 1045252) +++ krita/plugins/extensions/shiva/shivafilter.cpp (working copy) @@ -88,13 +88,19 @@ if (config) { QMap<QString, QVariant> map = config->getProperties(); for (QMap<QString, QVariant>::iterator it = map.begin(); it != map.end(); ++it) { + dbgPlugins << it.key() << " " << it.value(); const GTLCore::Metadata::Entry* entry = kernel.metadata()->parameter(it.key().toAscii().data()); if (entry and entry->asParameterEntry()) { - kernel.setParameter(it.key().toAscii().data(), qvariantToValue(it.value(), entry->asParameterEntry()->valueType())); + GTLCore::Value val = qvariantToValue(it.value(), entry->asParameterEntry()->valueType()); + if(val.isValid()) + { + kernel.setParameter(it.key().toAscii().data(), val); + } } } } { + dbgPlugins << "Compile: " << m_source->name().c_str(); QMutexLocker l(shivaMutex); kernel.compile(); #if OPENSHIVA_VERSION_MAJOR == 0 && OPENSHIVA_VERSION_MINOR == 9 && OPENSHIVA_VERSION_REVISION >= 12 @@ -106,7 +112,7 @@ std::list< GTLCore::AbstractImage* > inputs; inputs.push_back(&pdisrc); GTLCore::Region region(dstTopLeft.x(), dstTopLeft.y() , size.width(), size.height()); - dbgPlugins << dstTopLeft << " " << size; + dbgPlugins << "Run: " << m_source->name().c_str() << " " << dstTopLeft << " " << size; kernel.evaluatePixeles(region, inputs, &pdi #if OPENSHIVA_VERSION_MAJOR == 0 && OPENSHIVA_VERSION_MINOR == 9 && OPENSHIVA_VERSION_REVISION >= 12 , report Index: krita/plugins/extensions/shiva/shivagenerator.cpp =================================================================== --- krita/plugins/extensions/shiva/shivagenerator.cpp (revision 1045258) +++ krita/plugins/extensions/shiva/shivagenerator.cpp (working copy) @@ -85,7 +85,11 @@ for (QMap<QString, QVariant>::iterator it = map.begin(); it != map.end(); ++it) { const GTLCore::Metadata::Entry* entry = kernel.metadata()->parameter(it.key().toAscii().data()); if (entry and entry->asParameterEntry()) { - kernel.setParameter(it.key().toAscii().data(), qvariantToValue(it.value(), entry->asParameterEntry()->valueType())); + GTLCore::Value val = qvariantToValue(it.value(), entry->asParameterEntry()->valueType()); + if(val.isValid()) + { + kernel.setParameter(it.key().toAscii().data(), val); + } } } } Index: krita/plugins/extensions/shiva/QVariantValue.cpp =================================================================== --- krita/plugins/extensions/shiva/QVariantValue.cpp (revision 1045026) +++ krita/plugins/extensions/shiva/QVariantValue.cpp (working copy) @@ -20,6 +20,8 @@ #include <GTLCore/Type.h> #include <GTLCore/TypesManager.h> +#include "kis_debug.h" + QVariant valueToQVariant(const GTLCore::Value& value) { switch (value.type()->dataType()) { @@ -74,6 +76,11 @@ foreach(const QVariant& var, variant.toList()) { values.push_back(qvariantToValue(var, _type->embeddedType())); } + if( _type->dataType() == GTLCore::Type::VECTOR and values.size() != _type->vectorSize() ) + { + dbgPlugins << "Invalid numbers of element for a vector, got: " << values.size() << " but expected: " << _type->vectorSize(); + return GTLCore::Value(); + } return GTLCore::Value(values, _type); } default: _______________________________________________ kimageshop mailing list kimageshop@... https://mail.kde.org/mailman/listinfo/kimageshop |
|
|
Re: Fix crash when selecting a shiva filter or generatorOn Tuesday 10 November 2009, Cyrille Berger wrote:
> hi, > > Those two patches fixes crashes when selecting some of the shiva filters > that have already been used, and also when reconfiguring some of the > generators. > > I would like to backport them to branch/2.1. > I trust your expertise here, so it's okay as far as I'm concerned. -- Boudewijn Rempt | http://www.valdyas.org _______________________________________________ kimageshop mailing list kimageshop@... https://mail.kde.org/mailman/listinfo/kimageshop |
|
|
Re: Fix crash when selecting a shiva filter or generatorOn Tuesday 10 November 2009, Boudewijn Rempt wrote:
> On Tuesday 10 November 2009, Cyrille Berger wrote: > > hi, > > > > Those two patches fixes crashes when selecting some of the shiva filters > > that have already been used, and also when reconfiguring some of the > > generators. > > > > I would like to backport them to branch/2.1. > > I trust your expertise here, so it's okay as far as I'm concerned. sure the "expert" has not overlook something ;p -- Cyrille Berger _______________________________________________ kimageshop mailing list kimageshop@... https://mail.kde.org/mailman/listinfo/kimageshop |
|
|
Re: Fix crash when selecting a shiva filter or generatorOn Wednesday 11 November 2009, Cyrille Berger wrote:
> On Tuesday 10 November 2009, Boudewijn Rempt wrote: > > On Tuesday 10 November 2009, Cyrille Berger wrote: > > > hi, > > > > > > Those two patches fixes crashes when selecting some of the shiva > > > filters that have already been used, and also when reconfiguring some > > > of the generators. > > > > > > I would like to backport them to branch/2.1. > > > > I trust your expertise here, so it's okay as far as I'm concerned. > > well, while it is nice to have such confidence, the review is intented to > be sure the "expert" has not overlook something ;p > I see you check your variables now before setting them, so it _must_ be an improvement :-) -- Boudewijn Rempt | http://www.valdyas.org _______________________________________________ kimageshop mailing list kimageshop@... https://mail.kde.org/mailman/listinfo/kimageshop |
| Free embeddable forum powered by Nabble | Forum Help |