PDA

View Full Version : Designer plugin segfaults designer :(



tmarki
26th September 2007, 09:04
Hi,
I'm trying to extend Designer with a custom widget, but my widget keeps killing it with a segfault whenever I try to save the dialog the widget is on or I just try to preview it.

My custom widget is a rather simple QScrollArea derivative. Here's a (partial) backtrace of the crash:

#0 0xb7c0730f in DomWidget::write (this=0x0, doc=@0xbfc66fd0, tagName=@0xbfc66c38) at uilib/ui4.cpp:2859
#1 0xb7c07e04 in DomWidget::write (this=0x858f290, doc=@0xbfc66fd0,
tagName=@0xbfc66dd8) at uilib/ui4.cpp:2916
#2 0xb7c07e04 in DomWidget::write (this=0x858e808, doc=@0xbfc66fd0,
tagName=@0xbfc66ef4) at uilib/ui4.cpp:2916
#3 0xb7c09271 in DomUI::write (this=0x858f388, doc=@0xbfc66fd0,
tagName=@0xbfc66fe0) at uilib/ui4.cpp:271
#4 0xb7bd43d3 in QAbstractFormBuilder::save (this=0xbfc6707c,
dev=0xbfc670c0, widget=0x84fc768) at
uilib/abstractformbuilder.cpp:1037
#5 0xb7ebf2ca in qdesigner_internal::QDesignerResource::save
(this=0xbfc6707c, dev=0xbfc670c0, widget=0x84fc768) at
../formeditor/qdesigner_resource.cpp:158
#6 0xb7ecbdf2 in qdesigner_internal::FormWindow::contents
(this=0x84f0900) at ../formeditor/formwindow.cpp:1375
#7 0xb7c6927e in
qdesigner_internal::QDesignerFormBuilder::createPr eview (fw=0x84f0900,
styleName=@0xbfc67430, appStyleSheet=@0xbfc67434,
scriptErrors=0xbfc67208, errorMessage=0xbfc67458)
at shared/qdesigner_formbuilder.cpp:323
#8 0xb7c6a100 in
qdesigner_internal::QDesignerFormBuilder::createPr eview (fw=0x84f0900,
styleName=@0xbfc67430, appStyleSheet=@0xbfc67434,
errorMessage=0xbfc67458) at shared/qdesigner_formbuilder.cpp:373
#9 0xb7cffb5d in qdesigner_internal::PreviewManager::createPreview
(this=0x83eebe0, fw=0x84f0900, pc=@0xbfc67430,
errorMessage=0xbfc67458) at shared/previewmanager.cpp:270
#10 0xb7d00a9e in qdesigner_internal::PreviewManager::showPreview
(this=0x83eebe0, fw=0x84f0900, pc=@0xbfc67430,
errorMessage=0xbfc67458) at shared/previewmanager.cpp:309
#11 0x0808fd7d in QList<QString>::append ()
#12 0x080a8f82 in QList<QString>::append ()
#13 0xb6c4d859 in QMetaCallEvent::placeMetaCall (this=0x8404818,
object=0x83e7230) at kernel/qobject.cpp:491
#14 0xb6c5096b in QObject::event (this=0x83e7230, e=0x4901) at
kernel/qobject.cpp:1104
#15 0xb70cf39f in QApplicationPrivate::notify_helper (this=0x81434e8,
receiver=0x83e7230, e=0x8404818) at kernel/qapplication.cpp:3712
#16 0xb70d23e9 in QApplication::notify (this=0xbfc67b84,
receiver=0x83e7230, e=0x8404818) at kernel/qapplication.cpp:3271
#17 0xb6c3fe9a in QCoreApplication::notifyInternal (this=0xbfc67b84,
receiver=0x83e7230, event=0x8404818) at
kernel/qcoreapplication.cpp:546
#18 0xb6c412ed in QCoreApplicationPrivate::sendPostedEvents
(receiver=0x0, event_type=0, data=0x8143310) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:205
#19 0xb6c4158d in QCoreApplication::sendPostedEvents (receiver=0x0,
event_type=0) at kernel/qcoreapplication.cpp:1016
#20 0xb6c688d4 in postEventSourceDispatch (s=0x814a700) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:210
[snip]

I tried everything I could think of without success. :crying:
I'd be glad if someone would be able to help me out. I'm using the Qt 4.4 snapshot on Debian.
Thanks!

wysota
26th September 2007, 10:19
Does your widget work properly without using the plugin?

tmarki
26th September 2007, 10:21
Does your widget work properly without using the plugin?

Sure, it already works in an application, and the need arose to have it available in Designer, hence this new problem.

wysota
26th September 2007, 10:45
Could we see the plugin implementation?

tmarki
26th September 2007, 11:22
It seems like I found what the problem was.

In the constructor of the said widget I created a QLabel and assigned it to the ScrollArea with setWidget ().

After commenting out the setWidget line (and using setWidget later, when the QLabel actually got it's content set up) I can preview an save the dialog without a segfault.

I am puzzled why this helped, so if someone has an explanation it would be nice to know.