[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Wed Sep 14 21:59:21 CEST 2005


SVN commit 460696 by staikos:

fix updates of objects depending on vectors from plugins.  Perhaps quite
inefficient but at least it updates now.  NumNew is set to length() when a
plugin says it updated the output vectors.  Also fixes a bug in NumNew where it
became negative when vectorRealloced() was triggered.


 M  +7 -2      kstplugin.cpp  
 M  +5 -1      kstvector.cpp  


--- trunk/extragear/graphics/kst/kst/kstplugin.cpp #460695:460696
@@ -33,14 +33,16 @@
 #include "plugincollection.h"
 
 
-KstPlugin::KstPlugin() : KstDataObject() {
+KstPlugin::KstPlugin()
+: KstDataObject() {
   _inStringCnt = 0;
   _outStringCnt = 0;
   commonConstructor();
 }
 
 
-KstPlugin::KstPlugin(const QDomElement &e) : KstDataObject(e) {
+KstPlugin::KstPlugin(const QDomElement& e)
+: KstDataObject(e) {
   QString pluginName;
 
   _inStringCnt = 0;
@@ -379,6 +381,9 @@
         KstVectorPtr vp = _outputVectors[(*it)._name];
         vectorRealloced(vp, _outVectors[vitcnt], _outArrayLens[vitcnt]);
         vp->setDirty();
+        // Inefficient, but do we have any other choice?  We don't really know
+        // from the plugin how much of this vector is "new" or "shifted"
+        vp->setNewAndShift(vp->length(), vp->numShift());
         vp->update(update_counter);
         vitcnt++;
       } else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
--- trunk/extragear/graphics/kst/kst/kstvector.cpp #460695:460696
@@ -232,7 +232,11 @@
 double* KstVector::realloced(double *memptr, int newSize) {
   double *old = _v;
   _v = memptr;
-  NumNew = newSize - _size;
+  if (newSize < _size) {
+    NumNew = newSize; // all new if we shrunk the vector
+  } else {
+    NumNew = newSize - _size;
+  }
   _size = newSize;
   updateScalars();
   return old;


More information about the Kst mailing list