https://bugs.kde.org/show_bug.cgi?id=527804
Bug ID: 527804
Summary: Crashing sometimes when drawing a frame
Classification: Frameworks and Libraries
Product: Union
Version First unspecified
Reported In:
Platform: Arch Linux
OS: Linux
Status: REPORTED
Severity: crash
Priority: NOR
Component: QtWidgets Output
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
A self-written KDE program using QWidgets crashes *sometimes* when using Union
but runs without problems with the default style shipped with KDE Plasma. The
crash happens on an up-to-date ArchLinux installation using package union
6.8.1-1.
The crash is not reproducible, as sometimes the program runs flawlessly. My
guess is that the behavior depends on a decision made inside ElementCache, but
I have not inspected the source code to investigate this.
Running my program with gdb gives the following backtrace:
Thread 1 "myprogram" received signal SIGSEGV, Segmentation fault.
bt
0x00007ffff6393e25 in QMetaObject::cast (this=0x7ffff7b5ee00
<QTreeView::staticMetaObject>, obj=0x7ffff75d462f
<QFrame::paintEvent(QPaintEvent*)+127>) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qmetaobject.cpp:413
413 return (obj && obj->metaObject()->inherits(this)) ? obj : nullptr;
(gdb) bt
#0 0x00007ffff6393e25 in QMetaObject::cast (this=0x7ffff7b5ee00
<QTreeView::staticMetaObject>, obj=0x7ffff75d462f
<QFrame::paintEvent(QPaintEvent*)+127>) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qmetaobject.cpp:413
#1 0x00007fffe8d12aec in QtPrivate::qobject_cast_helper<QTreeView const*,
QObject const> (object=<optimized out>, object=<optimized out>) at
/usr/include/qt6/QtCore/qobjectdefs.h:766
#2 qobject_cast<QTreeView const*> (object=<optimized out>, object=<optimized
out>) at /usr/include/qt6/QtCore/qobject.h:442
#3 ItemViewElement::elementAttributes (this=<optimized out>) at
/usr/src/debug/union/union-6.8.1/src/output/qtwidgets/elements/ItemViewElement.cpp:229
#4 0x00007fffe8d00eda in AbstractElement::createElement
(this=this@entry=0x555555caa640, name=...) at
/usr/src/debug/union/union-6.8.1/src/output/qtwidgets/elements/AbstractElement.cpp:647
#5 0x00007fffe8d01414 in AbstractElement::prepareElements
(this=0x555555caa640, opt=<optimized out>, widget=<optimized out>,
targetHierarchy=...) at
/usr/src/debug/union/union-6.8.1/src/output/qtwidgets/elements/AbstractElement.cpp:475
#6 0x00007fffe8d133e5 in ItemViewElement::update (this=0x555555caa640) at
/usr/src/debug/union/union-6.8.1/src/output/qtwidgets/elements/ItemViewElement.cpp:39
#7 0x00007fffe8cfbf17 in ElementCache::detail::element<QStyle::ControlElement,
38> (output=std::shared_ptr<AbstractElement> (use count 2, weak count 0) =
{...}, hash=<optimized out>, style=<optimized out>, option=0x7fffffffc510,
widget=<optimized out>)
at /usr/include/c++/16/bits/shared_ptr_base.h:1752
#8 0x00007fffe8cf21e1 in operator() (__closure=<optimized out>) at
/usr/src/debug/union/union-6.8.1/src/output/qtwidgets/ElementCache.h:60
#9 ElementCache::element<QStyle::ControlElement, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46> (enumValue=enumValue@entry=46,
hash=<optimized out>,
style=style@entry=0x5555556f9870, option=option@entry=0x7fffffffc510,
widget=widget@entry=0x555555c64420) at
/usr/src/debug/union/union-6.8.1/src/output/qtwidgets/ElementCache.h:62
#10 0x00007fffe8cf3082 in UnionStyle::drawControl (this=0x5555556f9870,
controlElement=QStyle::CE_ShapedFrame, option=0x7fffffffc510,
painter=0x7fffffffc590, widget=0x555555c64420) at
/usr/src/debug/union/union-6.8.1/src/output/qtwidgets/UnionStyle.cpp:175
#11 0x00007ffff75d4558 in QFrame::drawFrame (this=this@entry=0x555555c64420,
p=p@entry=0x7fffffffc590) at
/usr/src/debug/qt6-base/qtbase/src/widgets/widgets/qframe.cpp:499
#12 0x00007ffff75d462f in QFrame::paintEvent (this=0x555555c64420) at
/usr/src/debug/qt6-base/qtbase/src/widgets/widgets/qframe.cpp:487
#13 0x00007ffff75c98c0 in QAbstractScrollArea::event (this=0x555555c64420,
e=0x7fffffffc720) at
/usr/src/debug/qt6-base/qtbase/src/widgets/widgets/qabstractscrollarea.cpp:929
#14 0x00007ffff750355f in QApplicationPrivate::notify_helper (this=<optimized
out>, receiver=0x555555c64420, e=0x7fffffffc720) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3279
#15 0x00007ffff63891d8 in QCoreApplication::notifyInternal2
(receiver=0x555555c64420, event=0x7fffffffc720) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1153
#16 0x00007ffff638922d in QCoreApplication::sendSpontaneousEvent
(receiver=<optimized out>, event=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1612
#17 0x00007ffff755675c in QWidgetPrivate::sendPaintEvent
(this=this@entry=0x555555cf0e20, toBePainted=...) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:5663
#18 0x00007ffff7556c37 in QWidgetPrivate::drawWidget
(this=this@entry=0x555555cf0e20, pdev=pdev@entry=0x555555cd27d8, rgn=...,
offset=..., flags=..., sharedPainter=sharedPainter@entry=0x0,
repaintManager=<optimized out>)
at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:5613
#19 0x00007ffff7559e01 in QWidgetPrivate::paintSiblingsRecursive
(this=this@entry=0x55555576a830, pdev=pdev@entry=0x555555cd27d8, siblings=...,
index=<optimized out>, index@entry=6, rgn=..., offset=..., flags=...,
sharedPainter=0x0, repaintManager=0x555555c34d30)
at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:5792
#20 0x00007ffff7559bc5 in QWidgetPrivate::paintSiblingsRecursive
(this=this@entry=0x55555576a830, pdev=pdev@entry=0x555555cd27d8, siblings=...,
index=6, rgn=..., offset=..., flags=..., sharedPainter=0x0,
repaintManager=0x555555c34d30)
at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:5778
#21 0x00007ffff7557209 in QWidgetPrivate::drawWidget (this=0x55555576a830,
pdev=0x555555cd27d8, rgn=..., offset=..., flags=..., sharedPainter=<optimized
out>, repaintManager=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:5654
#22 0x00007ffff757edc6 in QWidgetRepaintManager::paintAndFlush
(this=0x555555c34d30) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidgetrepaintmanager.cpp:913
#23 0x00007ffff756552f in QWidget::event (this=0x7fffffffd4a0,
event=0x555555c96fd0) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:9290
#24 0x00007ffff750355f in QApplicationPrivate::notify_helper (this=<optimized
out>, receiver=0x7fffffffd4a0, e=0x555555c96fd0) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3279
#25 0x00007ffff63891d8 in QCoreApplication::notifyInternal2
(receiver=0x7fffffffd4a0, event=event@entry=0x555555c96fd0) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1153
#26 0x00007ffff638a36f in QCoreApplication::sendEvent (receiver=<optimized
out>, event=0x555555c96fd0) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1598
#27 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0,
data=0x5555555a6610) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1953
#28 0x00007ffff66c66b8 in QCoreApplication::sendPostedEvents (receiver=0x0,
event_type=0) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1806
#29 postEventSourceDispatch (s=0x5555555abc80) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:248
#30 0x00007ffff58fc75e in g_main_dispatch (context=0x7fffec000f00) at
../glib/glib/gmain.c:3734
#31 0x00007ffff5905c50 in g_main_context_dispatch_unlocked
(context=0x7fffec000f00) at ../glib/glib/gmain.c:4603
#32 g_main_context_iterate_unlocked (context=context@entry=0x7fffec000f00,
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at
../glib/glib/gmain.c:4672
#33 0x00007ffff5905db5 in g_main_context_iteration (context=0x7fffec000f00,
may_block=1) at ../glib/glib/gmain.c:4738
#34 0x00007ffff66c4d22 in QEventDispatcherGlib::processEvents
(this=0x5555555ac430, flags=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:402
#35 0x00007ffff6396a74 in QEventLoop::processEvents (this=0x7fffffffd420,
flags=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:109
#36 QEventLoop::exec (this=0x7fffffffd420, flags=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:198
#37 0x00007ffff638cfca in QCoreApplication::exec () at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1496
#38 0x000055555555be0a in useURL (url=..., a=...) at
/xxx/xxx/xxx/myprogram/main.cpp:17
#39 0x000055555555c86a in main (argc=1, argv=0x7fffffffd918) at
/xxx/xxx/xxx/myprogram/main.cpp:45
My program has a custom 'paintEvent' implementation drawing a SVG image on the
dialog's background using QSvgRenderer. ProfileListDialog inherits from
QDialog.
void ProfileListDialog::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setOpacity(0.4);
const int xfactor = minimumWidth();
if (/* test condition A */)
d->qSvgRendererInstanceA.render(&painter, QRectF(width() - xfactor * 5
/ 8, -xfactor / 8, xfactor * 3 / 4, xfactor * 3 / 4));
else if (/* test condition B */)
d->qSvgRendererInstanceB.render(&painter, QRectF(width() - xfactor * 5
/ 8, -xfactor / 8, xfactor * 3 / 4, xfactor * 3 / 4));
// else
// qWarning() << "tertium non datur";
}
--
You are receiving this mail because:
You are watching all bug changes.