Mac OS X(Qt 4.8.0)で動作するが、Ubuntu Linux(Qt 4.7.4)でクラッシュするQtに対するLuaバインディングがあります。 Qtコードはdlopenでロードされ、app-> exec()でQtに渡されます。Qtを共有ライブラリとしてロードすると正しく閉じますか?
のLUAコード:
require 'mimas' -- Load shared library mimas.so linked to Qt libs
app = mimas.Application() -- Just a wrapper around QApplication
app:exec()
-- In some callback: app:quit()
Luaは終了する(APP後:EXEC()戻り)は、それがSIGSEGVで終わる 'MIMASの共有ライブラリにdlcloseのを行います。バックトレース:
Program received signal SIGSEGV, Segmentation fault.
QList<QFactoryLoader*>::removeAll (this=0x0, [email protected])
at ../../include/QtCore/../../src/corelib/tools/qlist.h:760
760 ../../include/QtCore/../../src/corelib/tools/qlist.h: No such file or directory.
in ../../include/QtCore/../../src/corelib/tools/qlist.h
(gdb) bt
#0 QList<QFactoryLoader*>::removeAll (this=0x0, [email protected])
at ../../include/QtCore/../../src/corelib/tools/qlist.h:760
#1 0x0131126c in QFactoryLoader::~QFactoryLoader (this=0x8104a48,
__in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:208
#2 0x01311302 in QFactoryLoader::~QFactoryLoader (this=0x8104a48,
__in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:209
#3 0x009143a8 in QGlobalStaticDeleter<QFactoryLoader>::~QGlobalStaticDeleter (
this=0x11c3200, __in_chrg=<optimized out>)
at ../../include/QtCore/../../src/corelib/global/qglobal.h:1825
#4 0x001e7d2b in __cxa_finalize() from /lib/i386-linux-gnu/libc.so.6
#5 0x00842a94 in __do_global_dtors_aux()
from /usr/lib/i386-linux-gnu/libQtGui.so.4
[snip]
#13 0x0016bd28 in dlclose() from /lib/i386-linux-gnu/libdl.so.2
このメモリのバグで終了しないようにQtを正しく閉じるにはどうすればよいですか?
問題は、qt_factory_loaders()がNULLを返しているようです。 Qt 4.8.0を試して、状況が変わったかどうかを調べます。
[編集]私は問題を絞り込むことができました(これはLuaとは関係ありません)。bug reportをqtに記入してください。
アプリ:EXEC()戻り値:終了()はQtは停止アプリする方法です。クラッシュはこのステップの後に起こります。 – gaspard