[Kde-perl] Suspicious QWidget Initialization Behaviour

Jonathan Yu jonathan.i.yu at gmail.com
Tue Aug 11 05:10:11 CEST 2009


Hi Chris:

I'm not sure where this is happening, or perhaps if it's just a usage
error. I'm creating a new object of a class that inherits from
Qt::Widget. I've noticed if I do [the equivalent of]:
Qt::Widget->new();

Then I get a core dump with the following backtrace:

#0  QWidget::sizePolicy (this=0x0) at kernel/qwidget.cpp:8925
8925	kernel/qwidget.cpp: No such file or directory.
	in kernel/qwidget.cpp
(gdb) bt full
#0  QWidget::sizePolicy (this=0x0) at kernel/qwidget.cpp:8925
No locals.
#1  0xb7a6a938 in xcall_QWidget (xi=<value optimized out>, obj=0x0,
    args=0x9bb7d08) at /home/jon/kdebindings/build/smoke/qt/x_20.cpp:4820
No locals.
#2  0xb7bd5153 in PerlQt::MethodCall::callMethod (this=0xbf9b1860)
    at src/marshall_types.h:132
	method = (Smoke::Method *) 0xb7b2feac
	fn = (void (*)(short int, void *,
    Smoke::StackItem *)) 0xb7a69c40 <xcall_QWidget(short, void*,
Smoke::StackItem*)>
	ptr = (void *) 0x0
	callreturn = {<PerlQt::MethodReturnValueBase> = {<Marshall> = {
      _vptr.Marshall = 0xbf9b1668}, _smoke = 0x80abc27, _methodIndex = -31492,
    _stack = 0x8f98548, _retval = 0xb7f32ff4}, <No data fields>}
#3  0xb7bd1f38 in PerlQt::MethodCallBase::next (this=0xbf9b1860)
    at src/marshall_types.cpp:387
	oldcur = -1
#4  0xb7bc803c in XS_AUTOLOAD (my_perl=0x8f98008, cv=0x99da9d8)
    at src/util.cpp:1223
	classId = 5364
	methodId = <value optimized out>
	rcid = <value optimized out>

It looks like a void pointer (ptr) is being passed to the sizePolicy,
and I'm not sure if this is a Qt bug or a PerlQt bug. Either way it's
due to improper checking of parameters -- ie maybe trying to
dereference the null pointer.

Thanks in advance for any help you can offer here.

On an unrelated note, I've discovered while debugging code that
"Carp::Always" is a very useful module. It makes calls to "die" dump a
full backtrace, meaning the issues with ambiguous methods croak'ing
from XS will dump a full backtrace. It's tremendously useful for
debugging.

Cheers,

Jonathan


More information about the Kde-perl mailing list