[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Apr 13 21:47:20 CEST 2004


This situation should be impossible.  If it happens, then there is definitely 
a bug and this is just masking it.  We need to track how a null pointer gets 
into the list.

On April 13, 2004 15:37, Andrew Walker wrote:
> CVS commit by arwalker:
>
> Perform some additional checks before using potentially invalid
> pointers. This prevents Kst from crashing when using plugins.
>
>
>   M +29 -19    updatethread.cpp   1.9
>
>
> --- kdeextragear-2/kst/kst/updatethread.cpp  #1.8:1.9
> @@ -175,4 +175,5 @@ bool UpdateThread::doUpdates(bool force)
>      for (i = 0; i < ncl.count(); ++i) {
>        KstDataObjectPtr dop = ncl[i];
> +      if( dop != NULL ) {
>  #if UPDATEDEBUG > 0
>        kdDebug() << "updating non-curve: " << (void*)dop << " - " <<
> dop->tagName() << endl; @@ -189,4 +189,9 @@ bool
> UpdateThread::doUpdates(bool force)
>          return U == KstObject::UPDATE;
>        }
> +      } else {
> +#if UPDATEDEBUG > 0
> +        kdDebug() << "updating non-curve error: dop is NULL" << endl;
> +#endif
> +      }
>      }
>
> @@ -194,12 +199,12 @@ bool UpdateThread::doUpdates(bool force)
>      if (U == KstObject::UPDATE || force) {
>        for (i = 0; i < cl.count(); ++i) {
> -        KstBaseCurvePtr dop = cl[i];
> +        KstBaseCurvePtr bcp = cl[i];
> +        if( bcp != NULL ) {
>  #if UPDATEDEBUG > 0
> -        kdDebug() << "updating curve: " << (void*)dop << " - " <<
> dop->tagName() << endl; +          kdDebug() << "updating curve: " <<
> (void*)bcp << " - " << bcp->tagName() << endl; #endif
> -
> -        dop->writeLock();
> -        dop->update(_updateCounter);
> -        dop->writeUnlock();
> +          bcp->writeLock();
> +          bcp->update(_updateCounter);
> +          bcp->writeUnlock();
>
>          if (_done || _paused) {
> @@ -209,4 +214,9 @@ bool UpdateThread::doUpdates(bool force)
>            return U == KstObject::UPDATE;
>          }
> +        } else {
> +#if UPDATEDEBUG > 0
> +          kdDebug() << "updating curve error: bcp is NULL" << endl;
> +#endif
> +        }
>        }
>      }
>
>
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst

-- 
George Staikos
KDE Developer			http://www.kde.org/
Staikos Computing Services Inc.	http://www.staikos.net/



More information about the Kst mailing list