I've encountered a few cases in KDE software where a dynamic_cast of something that's a KPart fails on OS X. I'm not that much of a C++ expert, so I wouldn't even know where to begin to debug such a situation. I've seen this happen with ktimetracker, and the latest (and better discussed) case is with Okular: https://bugs.kde.org/show_bug.cgi?id=345765
In a nutshell: the Okular::Part
class inherits the Okular::ViewInterface
class (as the last parent in a list). Yet when the code retrieves an Okular::Part*
instance (part
), dynamic_cast<Okular::ViewInterface*>(part)
returns NULL.
The last comment in the BKO ticket above is that using a static cast would be a poor man's fix in this case, but that I should try to figure out why the dynamic_cast fails. Which leads me to 2 questions:
- what does a dynamic_cast do in addition to a traditional cast here?
- how would I figure out why it fails? This would be an issue with the runtime, libc++, no?