[calligra] krita/plugins/paintops/libpaintop: Don't assert when storing a second deactivated sensor in the cache

Boudewijn Rempt boud at valdyas.org
Sun Sep 29 12:50:09 UTC 2013


Git commit 341247845a27860976a18711d86c92230b4ddc5b by Boudewijn Rempt.
Committed on 29/09/2013 at 12:29.
Pushed by rempt into branch 'master'.

Don't assert when storing a second deactivated sensor in the cache

CCBUG:322814
CCMAIL:kimageshop at kde.org

This removes an assert that checks whether a deactivated
sensor is stored another time. This happens when you check,
modify, uncheck a sensor for one preset, then go to another
preset of the same paintop type that has that sensor activated
and you deactivate it.

The problem seems to be, afaict, that we try to remember
the settings of deactivated sensors, but do that per paintop
instance, not per preset.

There are two proper solutions:

* remove the caching of custom settings for deactivated sensors
* save customized but deactivated sensors to the presets

The question is, which one shall it be?

M  +1    -6    krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.cpp
M  +0    -1    krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h

http://commits.kde.org/calligra/341247845a27860976a18711d86c92230b4ddc5b

diff --git a/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.cpp b/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.cpp
index db22ded..a8934db 100644
--- a/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.cpp
+++ b/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.cpp
@@ -70,7 +70,7 @@ bool KisMultiSensorsModel::setData(const QModelIndex &index, const QVariant &val
                 return true;
             } else {
                 KisDynamicSensor* sensor = m_listSensor->takeSensor(KisDynamicSensor::sensorsIds()[index.row()].id());
-                pushSensorToCache(sensor);;
+                m_sensorCache[sensor->id()] = sensor;
                 
                 // If there is only one sensor left, remove it from the list sensor, and delete the list sensor
                 QList<QString> ids = m_listSensor->sensorIds();
@@ -148,11 +148,6 @@ KisDynamicSensor* KisMultiSensorsModel::takeOrCreateSensorFromCache(const QStrin
     return sensor;
 }
 
-void KisMultiSensorsModel::pushSensorToCache(KisDynamicSensor* sensor)
-{
-    Q_ASSERT(!m_sensorCache.contains(sensor->id()));
-    m_sensorCache[sensor->id()] = sensor;
-}
 
 void KisMultiSensorsModel::setCurrentCurve(const QModelIndex& currentIndex, const KisCubicCurve& curve, bool useSameCurve)
 {
diff --git a/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h b/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h
index 2bef646..abb11ea 100644
--- a/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h
+++ b/krita/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h
@@ -49,7 +49,6 @@ signals:
 private:
     KisDynamicSensor* getOrCreateSensorFromCache(const QString& id);
     KisDynamicSensor* takeOrCreateSensorFromCache(const QString& id);
-    void pushSensorToCache(KisDynamicSensor*);
 private:
     KisDynamicSensor* m_currentSensor;
     KisDynamicSensorList* m_listSensor;


More information about the kimageshop mailing list