[Kde-pim] need help with dynamic_cast failing
Jason 'vanRijn' Kasper
vr at movingparts.net
Tue Nov 20 06:51:53 GMT 2007
re, all.
I've seen a few bug reports about this, and it seems that it's mostly (only?)
on debian-based systems. Anyway, I'm out of my C++ element, so I'd really
appreciate some help from the gurus. =:)
KPilot has a subclass of QCustomEvent that's declared and defined in
lib/kpilotdevicelink.cc. This subclass has a few basic additional data
private elements (2 ints and a QString), as well as a few public methods.
This little class (DeviceCommEvent) runs from a separate thread and is used
to pass status and message updates to the main GUI thread for user feedback,
etc., with code like this:
QApplication::postEvent(link(),
new DeviceCommEvent(EventLogProgress, QString::null, 30));
This is received by the main thread with this:
void KPilotDeviceLink::customEvent(QCustomEvent *e) ...
and inside that method, after checking the QCustomEvent::type(), I try a
dynamic_cast like this:
DeviceCommEvent* t = dynamic_cast<DeviceCommEvent*>(e);
Now, after that I check to make sure that t is valid, but what's happening is
that the dynamic_cast itself is segfaulting. I didn't think that that was
supposed to happen.
If anyone could help me understand why a dynamic_cast would be segfaulting and
how I can fix it, I'd really, really, really, really, really appreciate it!!
=:)
Thanks!!!
(gdb) thread apply all bt
Thread 2 (Thread -1236108400 (LWP 3308)):
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb75f38fc in pthread_cond_timedwait@@GLIBC_2.3.2 ()
from /lib/tls/i686/cmov/libpthread.so.0
#2 0xb7a025de in ?? () from /usr/lib/libqt-mt.so.3
#3 0xb6527298 in ?? ()
#4 0xb65272c8 in ?? ()
#5 0xb6527304 in ?? ()
#6 0xb75ce339 in DeviceMap::showList (this=0xb652730c)
at /tmp/kdepim-3.5.7enterprise20070926/kpilot/lib/kpilotdevicelink.cc:109
#7 0xb7a0281c in QThread::sleep () from /usr/lib/libqt-mt.so.3
#8 0xb75cd5c2 in DeviceCommThread::run (this=0x80d7210)
at /tmp/kdepim-3.5.7enterprise20070926/kpilot/lib/kpilotdevicelink.cc:628
#9 0xb7a03069 in QThreadInstance::start () from /usr/lib/libqt-mt.so.3
#10 0xb75ef46b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#11 0xb6d8373e in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 1 (Thread -1233549632 (LWP 3305)):
#0 0xb6ee47ae in __dynamic_cast () from /usr/lib/libstdc++.so.6
#1 0xb75caa9a in KPilotDeviceLink::customEvent (this=0x80e6dd0, e=0x80e4bc0)
at /tmp/kdepim-3.5.7enterprise20070926/kpilot/lib/kpilotdevicelink.cc:727
#2 0xb7a72f95 in QObject::event () from /usr/lib/libqt-mt.so.3
#3 0xb7a0aaf0 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#4 0xb7a0c91f in QApplication::notify () from /usr/lib/libqt-mt.so.3
#5 0xb6c29ca2 in KApplication::notify () from /usr/lib/libkdecore.so.4
#6 0xb799d209 in QApplication::sendEvent () from /usr/lib/libqt-mt.so.3
#7 0xb7a0bb28 in QApplication::sendPostedEvents ()
from /usr/lib/libqt-mt.so.3
#8 0xb7a0bc30 in QApplication::sendPostedEvents ()
from /usr/lib/libqt-mt.so.3
#9 0xb79b1101 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#10 0xb7a251ce in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#11 0xb7a24fde in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#12 0xb7a0c699 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#13 0x0807b9ac in main (argc=134762064, argv=0xbfbbd444)
at /tmp/kdepim-3.5.7enterprise20070926/kpilot/kpilot/pilotDaemon.cc:1400
--
-[ Jason 'vanRijn' Kasper // http://movingparts.net ]-
-[ KDE PIM Developer // http://www.kde.org ]-
-[ bash fun -> :(){ :|:&};: // Numbers 6:22-26 ]-
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list