[Kst] Potential crash...

Andrew Walker arwalker at sumusltd.com
Thu Feb 10 22:02:41 CET 2005

I could make it crash by trying to load the old demo.kst file.
It is of course trivial to make it crash by changing the value of
vectag in the .kst file by hand.

If you call load() later and vectag is not found then it returns false.
The object is deleted and (obviously) not added to the global data object 
list. There will be no crash.


On Thursday 10 February 2005 12:46, George Staikos wrote:
> On Thursday 10 February 2005 15:55, Andrew Walker wrote:
> > There is a potential crash scenario when loading from a .kst file with
> > PSDs, Histograms, etc. These objects define a vectag property, a
> > vector which must already exist. If this is not the case then a null
> > KstVectorPtr results, which is then used in numerous places without
> > checking).
> >
> > A better approach (instead of loading from the QDomElement in the
> > constructor) would be to declare a default constructor and then a
> > load(const QDomElement&) function which would return a bool to
> > indicate success or failure. If the object fails to load correctly it can
> > be deleted and an error message logged. At present Kst would crash.
>   Were you able to make it crash?  This should be covered by lazy loading I
> think.  There are known problems with dependency order if you hand-make
> a .kst file, but even calling load() later won't fix that I think.

More information about the Kst mailing list