[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Wed Aug 11 23:10:26 CEST 2004


I think you are calculating the number of frames incorrectly:

You are using the size of  the entire vector, which is only correct if you are 
reading from frame 0 to end, with skip off.

You need to consider starting frame, number of frames and skip, as well as the 
current data-source size.

Of course the user may ask to read to end of file which is small enough now, 
but not later, but there isn't a lot we can do about that in the wizard.

cbn

On August 11, 2004 04:40 pm, George Staikos wrote:
> CVS commit by staikos:
>
> add locking and fix my math
>
>
>   M +8 -2      datawizard.ui.h   1.74
>   M +8 -11     kstdoc.cpp   1.111
>
>
> --- kdeextragear-2/kst/kst/datawizard.ui.h  #1.73:1.74
> @@ -98,5 +98,7 @@ void DataWizard::sourceChanged( const QS
>              ds = KstDataSource::loadSource(file);
>              if (ds) {
> +                KST::dataSourceList.lock().writeLock();
>                  KST::dataSourceList.append(ds);
> +                KST::dataSourceList.lock().writeUnlock();
>              }
>          }
> @@ -350,5 +352,5 @@ void DataWizard::finished()
>      memoryAvailable = S(kb_main_free + kb_main_buffers + kb_main_cached);
>  #endif
> -    memoryRequested +=
> _ds->frameCount(_xVector->currentText())*_ds->samplesPerFrame(_xVector->cur
>rentText()); +    memoryRequested +=
> _ds->frameCount(_xVector->currentText())*_ds->samplesPerFrame(_xVector->cur
>rentText())*sizeof(double); {
>          QListViewItemIterator it(_vectors);
> @@ -357,5 +359,5 @@ void DataWizard::finished()
>              if (i->isOn()) {
>                  QString field = it.current()->text(0);
> -                memoryRequested +=
> _ds->frameCount(field)*_ds->samplesPerFrame(field); +               
> memoryRequested +=
> _ds->frameCount(field)*_ds->samplesPerFrame(field)*sizeof(double);
> n_steps++;
>              }
> @@ -510,5 +512,7 @@ void DataWizard::finished()
>                  c->setHasLines(false);
>              }
> +            KST::dataObjectList.lock().writeLock();
>              KST::dataObjectList.append(KstDataObjectPtr(c));
> +            KST::dataObjectList.lock().writeUnlock();
>              static_cast<Kst2DPlot*>((*pit).data())->addCurve(c);
>              if (!_onePlot->isChecked()) { // change plots if we are not
> onePlot... @@ -562,5 +566,7 @@ void DataWizard::finished()
>                      c->setHasLines(false);
>                  }
> +                KST::dataObjectList.lock().writeLock();
>                  KST::dataObjectList.append(KstDataObjectPtr(c));
> +                KST::dataObjectList.lock().writeUnlock();
>                  static_cast<Kst2DPlot*>((*pit).data())->addCurve(c);
>                  if (!_onePlot->isChecked()) { // change plots if we are
> not onePlot...
>
> --- kdeextragear-2/kst/kst/kstdoc.cpp  #1.110:1.111
> @@ -706,7 +706,4 @@ void KstDoc::forceUpdate() {
>
>  bool KstDoc::event(QEvent *e) {
> -  KMdiIterator<KMdiChildView*>* pIterator;
> -  KstViewWindow* pView;
> -
>    if (e->type() == KstEventTypeThread) {
>      _updating = true; // block update thread from sending events 'till
> we're done @@ -721,14 +718,14 @@ bool KstDoc::event(QEvent *e) {
>
>        if (KstApp::inst()) {
> -        pIterator = KstApp::inst()->createIterator();
> -        if (pIterator) {
> -          while (pIterator->currentItem()) {
> -            pView =
> dynamic_cast<KstViewWindow*>(pIterator->currentItem()); -            if
> (pView) {
> -              pView->view()->update();
> +        KMdiIterator<KMdiChildView*>* it =
> KstApp::inst()->createIterator(); +        if (it) {
> +          while (it->currentItem()) {
> +            KstViewWindow *view =
> dynamic_cast<KstViewWindow*>(it->currentItem()); +            if (view) {
> +              view->view()->update();
>              }
> -            pIterator->next();
> +            it->next();
>            }
> -          KstApp::inst()->deleteIterator(pIterator);
> +          KstApp::inst()->deleteIterator(it);
>          }
>        }
>
>
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst



More information about the Kst mailing list