[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] Re: Nellymoser audio segfaults (bug #24355])

From: Benjamin Wolsey
Subject: Re: [Gnash-dev] Re: Nellymoser audio segfaults (bug #24355])
Date: Tue, 23 Sep 2008 15:05:28 +0200

> >From MediaHandler.h documentation I read:
>         /// Create a VideoDecoder for the specified codec_type
>         //
>         /// @return 0 if no decoder could be created for the specified 
> encoding
>         ///
>         virtual std::auto_ptr<VideoDecoder> createVideoDecoder(VideoInfo& 
> info)=0;
> I like that design in general.
> Yes, there might be other exceptions thrown for OOM conditions or similar,
> but I'd rather have MediaHandler catch them then MediaHandler users.
But it's not how the VideoDecoder ever worked. Even less since I made it
throw an exception, but in that case there never was any check at all on
the validity of the object, or any possibility to do so.

> I belive MediaHandler factory methods should either return the fully
> constructed object requested, or the NULL auto_ptr.
It would be possible to catch the exception there, but then you have to
have a validity check (try/catch) both in MediaHandler and in the
callers (is return null). Seems unnecessary, but not such a serious

> The bug I see is that MediaHandlerFfmpeg::createAudioDecoder is just
> not checking return code from AudioDecoderFfmpeg::setup.

I don't think it's a good idea to have an object that can be created but
isn't valid until you've called setup() *and* checked the return code of
it. It's pointless and an unnecessary risk, when you can make absolutely
sure that no invalid objects ever exist by using the constructor and
exceptions. And it has the advantage of allowing a single debugging
message telling you exactly what failed and where, instead of several
that don't tell you very much.


Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]