mkottman / lqt

Lua bindings for Qt4 by Mauro Iazzi
http://code.google.com/p/lqt/
MIT License
191 stars 34 forks source link

segfault #8

Closed weepy closed 13 years ago

weepy commented 13 years ago

hi

i built lqt ok on ubuntu (11.4)

but when i run it i just get a segfault :(

running through gdb i get

Starting program: /usr/local/bin/lua test.lua [Thread debugging using libthread_db enabled] Cannot find new threads: generic error

but im not sure that's related to lqt

any ideas ?

weepy commented 13 years ago

ok - i managed to get rid of the thread problem (apparently something to do with gdb not liking when applications dynamically start using pthreads). However the error is not particularly revealing :

Program received signal SIGSEGV, Segmentation fault. 0x0805594f in luaH_getstr ()

mkottman commented 13 years ago

GDB acts funny when the application does not link to pthreads, but loads a module that does. I solve this by compiling Lua with the -pthread option, so that GDB can prepare itself.

What you are showing me is just the tip of the iceberg. The complete backtrace (bt full) would be nice, along with the Lua source that causes the crash.

xaberus commented 13 years ago

I do not know if this is related, but:

require 'qtcore'
require 'qtgui'

app = QApplication.new(select('#',...) + 1, {'lua', ...})

btn = QPushButton.new("Hello World!")
btn:connect('2pressed()', function(self)
    print("I'm about to close...")
    self:close()
end)
btn:setWindowTitle("A great example!")
btn:resize(300,50)
btn:show()

app.exec()

results in:

gdb lua 
GNU gdb (GDB) Fedora (7.3-41.fc15)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/lua...Reading symbols from /usr/lib/debug/usr/bin/lua.debug...done.
done.
(gdb) run test.lua 
Starting program: /usr/bin/lua test.lua
[Thread debugging using libthread_db enabled]
I'm about to close...

Program received signal SIGSEGV, Segmentation fault.
0x000000387b35a1a9 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
Missing separate debuginfos, use: debuginfo-install attica-0.2.0-1.fc15.x86_64 bzip2-libs-1.0.6-3.fc15.x86_64 dbus-libs-1.4.6-5.fc15.x86_64 dbusmenu-qt-0.6.3-3.fc15.x86_64 expat-2.0.1-11.fc15.x86_64 flac-1.2.1-6.fc12.x86_64 fontconfig-2.8.0-3.fc15.x86_64 freetype-2.4.4-5.fc15.x86_64 gamin-0.1.10-9.fc15.x86_64 glib2-2.28.8-1.fc15.x86_64 glibc-2.14-5.x86_64 kdebase-workspace-libs-4.6.5-5.fc15.x86_64 kdelibs-4.6.5-2.fc15.x86_64 keyutils-libs-1.2-7.fc15.x86_64 krb5-libs-1.9.1-5.fc15.x86_64 libICE-1.0.6-3.fc15.x86_64 libSM-1.2.0-2.fc15.x86_64 libX11-1.4.3-1.fc15.x86_64 libXau-1.0.6-2.fc15.x86_64 libXcursor-1.1.11-3.fc15.x86_64 libXdamage-1.1.3-2.fc15.x86_64 libXdmcp-1.1.0-2.fc15.x86_64 libXext-1.2.0-2.fc15.x86_64 libXfixes-5.0-1.fc15.x86_64 libXft-2.2.0-2.fc15.x86_64 libXi-1.4.3-1.fc15.x86_64 libXinerama-1.1.1-2.fc15.x86_64 libXpm-3.5.8-3.fc15.x86_64 libXrandr-1.3.1-2.fc15.x86_64 libXrender-0.9.6-2.fc15.x86_64 libXtst-1.2.0-2.fc15.x86_64 libXxf86vm-1.1.1-2.fc15.x86_64 libacl-2.2.49-11.fc15.x86_64 libasyncns-0.8-2.fc15.x86_64 libattr-2.4.44-7.fc15.x86_64 libcom_err-1.41.14-2.fc15.x86_64 libdrm-2.4.26-1.fc15.x86_64 libgcc-4.6.0-10.fc15.x86_64 libogg-1.2.2-3.fc15.x86_64 libpng-1.2.46-1.fc15.x86_64 libselinux-2.0.99-4.fc15.x86_64 libsndfile-1.0.25-1.fc15.x86_64 libstdc++-4.6.0-10.fc15.x86_64 libudev-167-4.fc15.x86_64 libuuid-2.19.1-1.4.fc15.x86_64 libvorbis-1.3.2-1.fc15.x86_64 libxcb-1.7-2.fc15.x86_64 libxml2-2.7.8-6.fc15.x86_64 mesa-libGL-7.11-1.fc15.x86_64 ncurses-libs-5.8-2.20110319.fc15.x86_64 openssl-1.0.0d-1.fc15.x86_64 phonon-4.5.0-2.fc15.x86_64 pulseaudio-libs-0.9.22-5.fc15.x86_64 pulseaudio-libs-glib2-0.9.22-5.fc15.x86_64 qt-4.7.3-8.fc15.x86_64 qt-webkit-4.7.3-8.fc15.x86_64 qt-x11-4.7.3-8.fc15.x86_64 readline-6.2-2.fc15.x86_64 soprano-2.6.0-2.fc15.x86_64 sqlite-3.7.5-3.fc15.x86_64 strigi-libs-0.7.2-8.fc15.x86_64 tcp_wrappers-libs-7.6-60.fc15.x86_64 xcb-util-0.3.6-2.fc15.x86_64 xz-libs-5.0.3-1.fc15.x86_64 zlib-1.2.5-3.fc15.x86_64
(gdb) bt full
#0  0x000000387b35a1a9 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
No symbol table info available.
#1  0x000000387b36edd2 in QObjectPrivate::setParent_helper(QObject*) () from /usr/lib64/libQtCore.so.4
No symbol table info available.
#2  0x000000387b371359 in QObject::~QObject() () from /usr/lib64/libQtCore.so.4
No symbol table info available.
#3  0x000000387b3749a9 in QSocketNotifier::~QSocketNotifier() () from /usr/lib64/libQtCore.so.4
No symbol table info available.
#4  0x00007ffff76312bf in ?? () from /usr/lib64/libQtDBus.so.4
No symbol table info available.
#5  0x00000030a5825a5b in ?? () from /lib64/libdbus-1.so.3
No symbol table info available.
#6  0x00000030a5824184 in ?? () from /lib64/libdbus-1.so.3
No symbol table info available.
#7  0x00000030a58241f9 in ?? () from /lib64/libdbus-1.so.3
No symbol table info available.
#8  0x00000030a5823607 in ?? () from /lib64/libdbus-1.so.3
No symbol table info available.
#9  0x00000030a580e082 in ?? () from /lib64/libdbus-1.so.3
No symbol table info available.
#10 0x00007ffff762e1de in ?? () from /usr/lib64/libQtDBus.so.4
No symbol table info available.
#11 0x00007ffff7634955 in ?? () from /usr/lib64/libQtDBus.so.4
No symbol table info available.
#12 0x00007ffff7634e29 in ?? () from /usr/lib64/libQtDBus.so.4
No symbol table info available.
#13 0x00007ffff762a5e3 in ?? () from /usr/lib64/libQtDBus.so.4
No symbol table info available.
#14 0x0000003ce1c38991 in __run_exit_handlers () from /lib64/libc.so.6
No symbol table info available.
#15 0x0000003ce1c38a15 in exit () from /lib64/libc.so.6
No symbol table info available.
#16 0x0000003ce1c213a4 in __libc_start_main () from /lib64/libc.so.6
No symbol table info available.
#17 0x0000000000401325 in _start ()
No symbol table info available.
(gdb) q
A debugging session is active.

        Inferior 1 [process 4819] will be killed.

Quit anyway? (y or n) y

(after pressing the button) or closing the window

mkottman commented 13 years ago

Ok, I discovered that this segmentation fault is caused by Qt changing it's mechanisms for deleting objects at exit in version 4.7.2 (which is default on Ubuntu). See this launchpad bug report for the PyQt4 package.

This segfault only happens on exit, so it should not do much harm. I will try manually updating Qt to 4.7.4 to see if this bug is resolved.

mkottman commented 13 years ago

I confirm that by building Qt 4.7.4 (which took a loooong time, a PPA would be nice) and building Lqt against this new version, the segmentation fault at exit is fixed.

Please upgrade Qt if the segfault at exit is causing you problems.