2012-03-21 18 views
1

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に記入してください。

答えて

0

あなたの質問が何であるか全くわからないが、あなたは明示的にapp:quit()

+0

アプリ:EXEC()戻り値:終了()はQtは停止アプリする方法です。クラッシュはこのステップの後に起こります。 – gaspard

0

で終了するQtアプリケーションは、(dlcloseのです伝えることができます)あなたが欲しい多分何?例えば

http://www.kernel.org/doc/man-pages/online/pages/man3/dlsym.3.html

The function dlclose() decrements the reference count on the dynamic library 
    handle handle. If the reference count drops to zero and no other loaded 
    libraries use symbols in it, then the dynamic library is unloaded. 

    The function dlclose() returns 0 on success, and nonzero on error. 

#ifdef MAC_OS 
    // unload library for MAC 
#else //if linux 
    dlclose(lib_handle); 
#endif 
+0

バックトレースからわかるように、 'dlclose'はlua_close操作(フレーム13)の一部としてLuaによって呼び出されます。クラッシュは 'dlclose'の間に発生します。 – gaspard

関連する問題