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

Dag Nygren dag at newtech.fi
Tue Jan 31 20:52:51 UTC 2006

> On Tuesday 31 January 2006 14:54, Dag Nygren wrote:

> > 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. 

Sure, but we are talking networking here. You can never assume
that a network connection stays up and running 100%, never.

> Regardless, most of 
> the database queries _are_ checked for failure. 

Not all of them by far.
I fixed one of my admittingly smallish problems by adding a check,
but that was not accepted as a patch as this was a problem only for
me and one other guy... (in TVRec::DoGetNextChannel() )

>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.

MSqlQuery::exec() is not trying to reconnect but just pass the query on to
QSqlQuery::exec() and then logs it. Can't see prepare( kicking the database

> Furthermore, InitCon returns a structure, not a pointer, and nothing external 
> to the database classes should be using the internal data of that class. 

OK, sorry about that, it is a structure.
> Strangely enough, proper error handling is in those database classes.



More information about the mythtv-dev mailing list