[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: handling a failed loading of images
From: Jos van den Oever <jos.van.den.oever () kogmbh ! com>
Date: 2009-09-01 5:58:01
Message-ID: 200909010758.01464.jos.van.den.oever () kogmbh ! com
[Download RAW message or body]
On Monday 31 August 2009 21:03:49 Thomas Zander wrote:
> On Monday 31. August 2009 13.13.51 Jos van den Oever wrote:
> > When loading images, the function KoImageCollection::createImageData is
> > called. If imageData does not contain valid image data, the data is not
> > loaded and the assert Q_ASSERT(data->key() == key) fails.
>
> Aha, sounds like a unit test that we should have, but don't...
Right, loading non-image data in a unit test. That's a useful unit test I'll
look into it.
> > Adding a check
> > if (data->errorCode() != KoImageData::Success) {
> > ....
> > }
> > is needed after data->setImage(imageData). The question I have is, how to
> > propagate the error. The function description does not describe how the
> > function behaves when loading fails.
>
> I think we should use the KoImageData::isValid() for that. It looks like
> the perfect usage.
That is what one can use for the check in KoImageCollection::createImageData
instead of "data->errorCode() != KoImageData::Success". What I would like to
know is how to tell the caller of KoImageCollection::createImageData to tell
that the image is bad. Do you mean an invalid IoImageData object should be
passed (instead of e.g. a NULL pointer)? That is a solution. Then how to
inform the caller what the nature of the error is? (Bad data or bad disk).
Cheers,
Jos
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic