[Kde-bindings] Threads + smoke + perl?

Chris Burel chrisburel at gmail.com
Fri Oct 3 09:06:12 UTC 2008


I get this error when trying to make a QFileDialog widget.

Here's what I think is happening:
Qt4 has threading, and so does my build of perl.  I start up perl and
load in my Qt xs module.  Everything is cool, but the QFileDialog
forks from the main thread (I believe) at which point I loose my
pointer to my interpreter.  So then when I go to create a new SV, it
says "What perl?" and segfaults, which is why in the backtrace I get
'my_perl=0x0'.
This happens in the Binding::callMethod function.  If I just return
false out of it to not override virtual methods, I don't have a
problem.

Does QtRuby have to work to get threads to work?  Or is there a way to
build Qt4 without threads?  How do I get the perl interpreter to be
visible to child threads?

The specific context is this, where the *ptr is the ptr passed in from
smoke to the virtual method call.
SV *getPointerObject(void *ptr) {
    HV *hv = pointer_map;
    SV *keysv = newSViv((IV)ptr); //This fails

And the output from gdb:
Looking for virtual method override for 1422 0x6b0820->QApplication::notify()
[New LWP 28876]

Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 28876]
0x00002b68957d0481 in Perl_newSViv (my_perl=0x0, i=7014432) at sv.c:6993
6993        new_SV(sv);
(gdb) bt
#0  0x00002b68957d0481 in Perl_newSViv (my_perl=0x0, i=7014432) at sv.c:6993
#1  0x00002b689631c08e in getPointerObject (ptr=0x6b0820) at Qt.xs:210
#2  0x00002b689632791d in PerlQt::Binding::callMethod
(this=0x2b68964336e0, method=1422, ptr=0x6b0820, args=0x40402e90,
isAbstract=false)
    at binding.cpp:31
#3  0x00002b6897bccc74 in x_QApplication::notify () from
/pts/testPipe/share/Qt4/def/dat/kdebindings/smoke/qt/libsmokeqt.so.2
#4  0x00002b689662180d in QCoreApplication::notifyInternal
(this=0x6b0820, receiver=0x532010, event=0x40402fc0) at
kernel/qcoreapplication.cpp:587
#5  0x00002b6896625aa3 in QCoreApplication::sendEvent
(receiver=0x532010, event=0x40402fc0) at kernel/qcoreapplication.h:215
#6  0x00002b6896637733 in QObjectPrivate::setParent_helper
(this=0xede6a0, o=0x532010) at kernel/qobject.cpp:1903
#7  0x00002b689663743e in QObject::setParent (this=0x40403120,
parent=0x532010) at kernel/qobject.cpp:1847
#8  0x00002b68966344e4 in QObject (this=0x40403120, parent=0x532010)
at kernel/qobject.cpp:707
#9  0x00002b68966422aa in QSocketNotifier (this=0x40403120, socket=6,
type=Read, parent=0x532010) at kernel/qsocketnotifier.cpp:174
#10 0x00002b6896603608 in QInotifyFileSystemWatcherEngine::run
(this=0x532010) at io/qfilesystemwatcher_inotify.cpp:209
#11 0x00002b689652325d in QThreadPrivate::start (arg=0x532010) at
thread/qthread_unix.cpp:190
#12 0x00002b6895d7e84f in ?? () from /lib64/tls/libpthread.so.0
#13 0x00002b6895f46703 in clone () from /lib64/tls/libc.so.6
#14 0x0000000000000000 in ?? ()



More information about the Kde-bindings mailing list