I would like to follow up with a bit more information on this issue. I
just tried yesterday's snapshot, and the issue is still there except
that the qt_plugin_instance() method is now called from
corelib/plugin/qlibrary.cpp line 467 (same issue, just the line number
shifted).
However, when I call unload() I also get a crash with the following backtrace:
#0 0xb137cf44 in ?? ()
#1 0xb5e9dd85 in qDeleteInEventHandler (o=0xb5a96140) at
kernel/qobject.cpp:3736
#2 0xb5e9f653 in QObject::event (this=0x841aee8, e=0xb023f728) at
kernel/qobject.cpp:1089
#3 0xb650492c in QApplicationPrivate::notify_helper (this=0x805e6b8,
receiver=0x841aee8, e=0xb023f728) at kernel/qapplication.cpp:3949
#4 0xb650c82e in QApplication::notify (this=0x805e6a0,
receiver=0x841aee8, e=0xb023f728) at kernel/qapplication.cpp:3496
#5 0xb5e8ed9b in QCoreApplication::notifyInternal (this=0x805e6a0,
receiver=0x841aee8, event=0xb023f728) at
kernel/qcoreapplication.cpp:589
#6 0xb5e8f9e5 in QCoreApplicationPrivate::sendPostedEvents
(receiver=0x0, event_type=0, data=0x80534e0)
at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:209
#7 0xb5e8fbdd in QCoreApplication::sendPostedEvents (receiver=0x0,
event_type=0) at kernel/qcoreapplication.cpp:1117
#8 0xb5eba98f in postEventSourceDispatch (s=0x8063cd8) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:214
#9 0xb58d42d9 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#10 0xb58d785b in ?? () from /usr/lib/libglib-2.0.so.0
#11 0xb58d79d8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#12 0xb5eba5d8 in QEventDispatcherGlib::processEvents (this=0x8061a08,
flags={i = -1076452840}) at kernel/qeventdispatcher_glib.cpp:319
#13 0xb65a1375 in QGuiEventDispatcherGlib::processEvents
(this=0x8061a08, flags={i = -1076452792}) at
kernel/qguieventdispatcher_glib.cpp:198
#14 0xb5e8d3da in QEventLoop::processEvents (this=0xbfd6a2c0, flags={i
= -1076452728}) at kernel/qeventloop.cpp:145
#15 0xb5e8d81a in QEventLoop::exec (this=0xbfd6a2c0, flags={i =
-1076452664}) at kernel/qeventloop.cpp:196
#16 0xb5e8fca9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:866
#17 0xb65047a7 in QApplication::exec () at kernel/qapplication.cpp:3424
#18 0x080493b9 in main (argc=1, argv=0xbfd6a3e4) at
/home/arendjr/Projects/HyvesDesktop/trunk/src/main.cpp:23
Interesting is that when I look inside qDeleteInEventHandler() then
the object that is being deleted is of type QObject (according to its
QMetaObject) and its d_ptr has a value of 0. So the crash is not
really surprising, but I honoustly have no clue as to where that
QObject is coming from that is being deleted. As far as I can see, all
the objects in my plugin are getting properly cleaned up (when I fix
the re-instantiation issue) and it appears that plugin unloading is
just horribly broken in QPluginLoader :(
Greetings,
Arend.
On Wed, Nov 19, 2008 at 16:53, Arend van Beelen <[EMAIL PROTECTED]> wrote:
> Hi again,
>
> I'm not sure if the following is specific to the Qt 4.5 snapshot, but
> at least that's where I'm getting the following "interesting" problem
> :)
>
> If have loaded a plugin using QPluginLoader and retrieved its root
> object using QPluginLoader::instance(). Now I want to unload the
> plugin, and this is where it goes wrong.
>
> The docs say the following about unloading plugins:
> "Warning: The root component of a plugin, returned by the instance()
> function, becomes invalid once the plugin is unloaded. Delete the root
> component before unloading the plugin."
>
> So, what I do is delete the root object, and then I call
> QPluginLoader::unload(). However, at this point my root object gets
> re-instantiated. Apparently, this is because QPluginLoader::unload()
> calls QLibraryPrivate::unload() which calls qt_plugin_instance() (at
> corelib/plugin/qlibrary.cpp:451).
>
> So, my question is, why does QPluginLoader::unload() create a new
> instance of the root object which I am actually supposed to delete
> before unloading?
>
> Greetings,
> Arend.
>
> --
> Arend van Beelen jr.
> "If you want my address, it's number one at the end of the bar."
--
Arend van Beelen jr.
"If you want my address, it's number one at the end of the bar."
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback