[vlc-devel] [PATCH] caopengllayer: do not return an error when crop/zoom/aspect/etc fail

Rémi Denis-Courmont remi at remlab.net
Sat Oct 26 18:00:46 CEST 2019


Le samedi 26 octobre 2019, 17:07:54 EEST Alexandre Janniaux a écrit :
> Hi,
> 
> On Sat, Oct 26, 2019 at 01:11:15PM +0100, Rémi Denis-Courmont wrote:
> > Hi,
> > 
> > The implementation ought to allocate enough resources upfront that locking
> > cannot fail. Otherwise, how do you clean up the OpenGL context that you
> > can't even lock??
> I agree that it would be the sane way, but we have multiple
> example of things that were broken by Apple during the
> deprecation of OpenGL, and the function doesn't specify why
> it would fail.
> 
> So my only source of truth is the list of error code, where
> you can find kCGLBadAlloc. But you could have perfectly
> valid other issues from outside of this module like:
> + kCGLBadConnection
> + kCGLBadWindow
> + kCGLBadDisplay
> + kCGLBadDrawable

Those are all specific variants of invalid argument errors, that only a buggy 
app can trigger. I'm all for handling possible errors, to the extent they're 
actually handlable and handled. Checking for an error code and skipping a bit 
of code is rarely proper error handling.

IMO, bullshit "defensive" programming is much worse than assertions or simply 
not handling errors, as it solves nothing; it only makes debugging harder.

-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list