[mythtv] [mythtv-commits] Ticket #1147: permissions problem -> coredump

Isaac Richards ijr at case.edu
Tue Jan 31 20:18:02 UTC 2006

On Tuesday 31 January 2006 14:54, Dag Nygren wrote:
> >  Even then I can't agree with your when you move milestone from 0.19 to
> >  0.20 and let this problem open in 0.19. Segmentation fault type crash is
> > a coding problem and should be always fixed ASAP IMHO. This kind of
> > coding style is very dangerous, specially when you write code that works
> > in network (even if the network is somehow closed).
> Yes, this is an unfortunate thing in MythTV. There are umpteens of
> functions calls where the return value is never checked, it is just
> assumed that everything is OK. (For example look at all the calls to
> InitCon() and the handling of the returned database pointer after
> this).
> This style is bound to create unnecessary bugs and crashes.

Yeah, that's a great example.

If your database isn't working, you have bigger issues.  Regardless, most of 
the database queries _are_ checked for failure.  It's completely unnecessary 
to check to see if the database is working before trying to run the query 
against it.  Worst case in that situation is that it tries to reconnect and 
if it can't and the query still fails, well, that's probably already being 
tested for.

Furthermore, InitCon returns a structure, not a pointer, and nothing external 
to the database classes should be using the internal data of that class.  
Strangely enough, proper error handling is in those database classes.


More information about the mythtv-dev mailing list