[mythtv-commits] Ticket #2725: dynamic_cast can return NULL, must test

MythTV mythtv at cvs.mythtv.org
Sat Nov 25 07:06:08 UTC 2006

#2725: dynamic_cast can return NULL, must test
 Reporter:  nigel   |       Owner:  nigel  
     Type:  defect  |      Status:  new    
 Priority:  minor   |   Milestone:  unknown
Component:  mythtv  |     Version:  0.20   
 Severity:  medium  |  
 There are a few places in the code where the result of dynamic_cast isn't
 tested before it is used. Sadly, in some cases, it can return NULL, which
 causes a bus error or SEGV.
 One particuar problem is in the keypress event processing. Causes a crash
 on OS X binaries built on 10.4 (gcc4), but running on 10.3. It is an old
 problem, usually caused by incorrectly compiling with -no-rtti: http://www
 Some documents (''e.g.''
 http://www.cplusplus.com/doc/tutorial/typecasting.html) say that
 dynamic_cast ing a base class to a subclass is illegal. QKeyEvent is a
 base class of QEvent, so if I believe this, it is the problem here.

Ticket URL: <http://svn.mythtv.org/trac/ticket/2725>
MythTV <http://www.mythtv.org/>

More information about the mythtv-commits mailing list