[mythtv] OS X 10.3 and MythTV 0.20

Nigel Pearson nigel at ind.tansu.com.au
Sat Nov 4 10:32:40 UTC 2006


The good news:
1) I have been able to reproduce the problem,
with both David Snider's packages, and my own
10.4/Xcode2.4 builds, and
2) I have a hacky workaround

The bad news:
1) I won't be committing this hack any time soon
(because it is not the right way to fix it), and
2) I have _not_ been able to reproduce the fault
with 10.3 constructed packages
(which Tony reported)


...
> It looks like the event being passed through
> the methods is invalid (possibly null)

Yep. All events are NULL.

> so the dynamic cast at mythmainwindow.cpp line 1096 fails.

Spot-on, Andrew!
(wish I had read this _before_ I spent a few
  hours tracing, patching and rebuilding :-)

It seems related to compiler RTTI stuff.
See this really old discussion:
http://www.gossamer-threads.com/lists/mythtv/dev/72747

What I don't understand is why it is failing in
the older runtime environment. Still tracing,
but any casting should be in the generated code.
Not in libC.

Anyway, here is a workaround:

% svn diff
Index: mythmainwindow.cpp
===================================================================
--- mythmainwindow.cpp  (revision 11680)
+++ mythmainwindow.cpp  (working copy)
@@ -1081,9 +1081,14 @@
      {
          case QEvent::KeyPress:
          {
+            QKeyEvent *ke = dynamic_cast<QKeyEvent*>(e);
+
+            /* Weird Mac OS X bug? */
+            if (!ke)
+                ke = (QKeyEvent *)e;
+
              if (currentWidget())
              {
-                QKeyEvent *ke = dynamic_cast<QKeyEvent*>(e);
                  ke->accept();
                  QWidget *current = currentWidget();
                  if (current && current->isEnabled())
@@ -1100,7 +1105,7 @@
                  MythScreenType *top = (*it)->GetTopScreen();
                  if (top)
                  {
-                    if (top->keyPressEvent(dynamic_cast<QKeyEvent*> 
(e)))
+                    if (top->keyPressEvent(ke))
                          return true;
                  }
              }
%

--
Nigel Pearson, nigel at ind.tansu.com.au| I've been talking to
Telstra Net. Eng., Sydney, Australia | the ship's computer.
Office: 9202 3900    Fax:  9261 3912 | ... It hates me!
Mobile: 0408 664435  Home: 9792 6998 |       Marvin


More information about the mythtv-dev mailing list