Bug 432246 - Cantata crashes with breeze
Summary: Cantata crashes with breeze
Status: RESOLVED FIXED
Alias: None
Product: Breeze
Classification: Plasma
Component: general (show other bugs)
Version: 5.20.90
Platform: Other Linux
: VHI normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL: https://github.com/CDrummond/cantata/...
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-01-28 12:30 UTC by pmargeti34
Modified: 2021-02-04 02:54 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pmargeti34 2021-01-28 12:30:16 UTC
SUMMARY
Breeze QT style causes a crash in Cantata
For detailed info about the bug please see the provided URL in additional info

STEPS TO REPRODUCE
1. update to kde beta 5.20.90
2. launch cantata
3. cry

OBSERVED RESULT
cantata crashes

EXPECTED RESULT
cantata works with breeze style

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: linux (archlinux)
(available in About System)
KDE Plasma Version: 5.20.90
KDE Frameworks Version: 5.78
Qt Version: 5.15.2

ADDITIONAL INFORMATION
https://github.com/CDrummond/cantata/issues/1672
Comment 1 David Edmundson 2021-01-28 12:37:22 UTC
Is it possible to get debug symbols for breeze please
Comment 2 David Redondo 2021-01-28 12:51:20 UTC
#0  QRasterPaintEngine::penChanged (this=0x7fffec007fd0) at painting/qpaintengine_raster.cpp:700
#1  0x00007ffff6b666d0 in QPainter::setPen (this=<optimized out>, pen=...) at painting/qpainter.cpp:3923
#2  0x00007fffea9720c5 in Breeze::Style::drawWidgetPrimitive (this=0x555555e6b2e0, option=0x7fffffffc090, painter=0x7fffffffc200, widget=0x7fffffffd380)
    at /home/david/kde/src/breeze/kstyle/breezestyle.cpp:972
#3  0x00007fffea99a05d in std::__invoke_impl<bool, bool (Breeze::Style::*&)(QStyleOption const*, QPainter*, QWidget const*) const, Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*> (__f=
    @0x7fffffffbf40: (bool (Breeze::Style::*)(const Breeze::Style * const, const QStyleOption *, QPainter *, const QWidget *)) 0x7fffea971ea4 <Breeze::Style::drawWidgetPrimitive(QStyleOption const*, QPainter*, QWidget const*) const>, __t=...) at /usr/include/c++/9/bits/invoke.h:66
#4  0x00007fffea9996c3 in std::__invoke<bool (Breeze::Style::*&)(QStyleOption const*, QPainter*, QWidget const*) const, Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*> (__fn=
    @0x7fffffffbf40: (bool (Breeze::Style::*)(const Breeze::Style * const, const QStyleOption *, QPainter *, const QWidget *)) 0x7fffea971ea4 <Breeze::Style::drawWidgetPrimitive(QStyleOption const*, QPainter*, QWidget const*) const>) at /usr/include/c++/9/bits/invoke.h:95
#5  0x00007fffea99873b in std::_Function_handler<bool (Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*), bool (Breeze::Style::*)(QStyleOption const*, QPainter*, QWidget const*) const>::_M_invoke(std::_Any_data const&, Breeze::Style const&, QStyleOption const*&&, QPainter*&&, QWidget const*&&) (__functor=..., __args#0=..., __args#1=@0x7fffffffbeb8: 0x7fffffffc090, __args#2=@0x7fffffffbeb0: 0x7fffffffc200, 
    __args#3=@0x7fffffffbea8: 0x7fffffffd380) at /usr/include/c++/9/bits/std_function.h:317
#6  0x00007fffea99563e in std::function<bool (Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*)>::operator()(Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*) const (this=0x7fffffffbf40, __args#0=..., __args#1=0x7fffffffc090, __args#2=0x7fffffffc200, 
    __args#3=0x7fffffffd380) at /usr/include/c++/9/bits/std_function.h:688
#7  0x00007fffea971e40 in Breeze::Style::drawPrimitive (this=0x555555e6b2e0, element=QStyle::PE_Widget, option=0x7fffffffc090, painter=0x7fffffffc200, 
    widget=0x7fffffffd380) at /home/david/kde/src/breeze/kstyle/breezestyle.cpp:948
#8  0x0000555555aeba3e in ProxyStyle::drawPrimitive(QStyle::PrimitiveElement, QStyleOption const*, QPainter*, QWidget const*) const ()
#9  0x00007ffff6fcfd21 in QWidgetPrivate::paintBackground (this=this@entry=0x555555fad040, painter=painter@entry=0x7fffffffc200, rgn=..., flags=...)
    at kernel/qwidget.cpp:2280
#10 0x00007ffff6fd40c3 in QWidgetPrivate::drawWidget (this=0x555555fad040, pdev=0x555556897a70, rgn=..., offset=..., flags=..., sharedPainter=0x0, 
    repaintManager=0x5555566bcf50) at kernel/qwidget.cpp:5357
#11 0x00007ffff6faa499 in QWidgetRepaintManager::paintAndFlush (this=this@entry=0x5555566bcf50)
    at ../../include/QtCore/../../src/corelib/tools/qpoint.h:122
#12 0x00007ffff6faad9f in QWidgetRepaintManager::sync (this=0x5555566bcf50, exposedWidget=0x7fffffffd380, exposedRegion=...)
    at kernel/qwidgetrepaintmanager.cpp:743
#13 0x00007ffff6ff885c in QWidgetWindow::handleExposeEvent (this=<optimized out>, event=0x7fffffffc930)
    at ../../include/QtGui/../../src/gui/kernel/qevent.h:479
#14 0x00007ffff6ff9258 in QWidgetWindow::event (event=0x7fffffffc930, this=0x5555566bca60) at kernel/qwidgetwindow.cpp:347
#15 QWidgetWindow::event (this=0x5555566bca60, event=0x7fffffffc930) at kernel/qwidgetwindow.cpp:239
#16 0x00007ffff6f97dc3 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5555566bca60, e=0x7fffffffc930)
    at kernel/qapplication.cpp:3632
#17 0x00007ffff6fa0bb8 in QApplication::notify(QObject*, QEvent*) () at kernel/qapplication.cpp:3156
--Type <RET> for more, q to quit, c to continue without paging--
#18 0x00007ffff64c069a in QCoreApplication::notifyInternal2 (receiver=0x5555566bca60, event=0x7fffffffc930)
    at ../../include/QtCore/5.15.2/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:325
#19 0x00007ffff68a3823 in QGuiApplicationPrivate::processExposeEvent (e=0x555556876230) at kernel/qguiapplication.cpp:3258
#20 0x00007ffff68a3a5b in QGuiApplicationPrivate::processWindowSystemEvent (e=0x555556876230) at kernel/qguiapplication.cpp:2070
#21 0x00007ffff687b7ac in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#22 0x00007ffff1fa0d7e in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#23 0x00007ffff4fa1fbd in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007ffff4fa2240 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff4fa22e3 in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007ffff651afa2 in QEventDispatcherGlib::processEvents (this=0x555555e97f80, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x00007ffff64bf1ab in QEventLoop::exec (this=this@entry=0x7fffffffcc10, flags=..., flags@entry=...)
    at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#28 0x00007ffff64c7354 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#29 0x000055555572f9e1 in main ()
Comment 3 David Redondo 2021-01-28 12:52:22 UTC
Before the crash I get a 

QWidget::repaint: Recursive repaint detected
QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?

in the console.
Comment 4 David Redondo 2021-01-28 13:01:39 UTC
Running it in valgrind:
https://invent.kde.org/-/snippets/1475
Comment 5 David Redondo 2021-01-28 13:16:17 UTC
Bisected it to 509ff6bc48f4baef7e0965071f9ee5b5a1840474

Doesn't crash on master with colorscheme that has not header colors group, so something with drawing the header area I suppose.
Comment 6 pmargeti34 2021-01-28 14:17:24 UTC
Thank you for providing debug symbols @David Redondo
Comment 7 David Edmundson 2021-01-28 14:24:47 UTC
And found.

The bug is slightly before.



#18 0x0000555555742bcd in MainWindow::controlView(bool) ()
#19 0x00007ffff70418a9 in QWidget::event (this=0x7fffffffda60, event=0x7fffffffbc50) at /home/david/projects/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8810
#20 0x00007ffff71c84e4 in QMainWindow::event (this=0x7fffffffda60, event=0x7fffffffbc50) at /home/david/projects/qt5/qtbase/src/widgets/widgets/qmainwindow.cpp:1341
#21 0x00007ffff6ff3d3b in QApplicationPrivate::notify_helper (this=0x555555d3ebe0, receiver=0x7fffffffda60, e=0x7fffffffbc50)
    at /home/david/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3632
#22 0x00007ffff6ff3b2c in QApplication::notify (this=0x7fffffffd790, receiver=0x7fffffffda60, e=0x7fffffffbc50)
    at /home/david/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3582
#23 0x00007ffff61649c5 in QCoreApplication::notifyInternal2 (receiver=0x7fffffffda60, event=0x7fffffffbc50)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1064
#24 0x00007ffff616541c in QCoreApplication::sendEvent (receiver=0x7fffffffda60, event=0x7fffffffbc50) at /home/david/projects/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1462
#25 0x00007ffff703d978 in QWidgetPrivate::updateContentsRect (this=0x555555ef0480) at /home/david/projects/qt5/qtbase/src/widgets/kernel/qwidget.cpp:7399
#26 0x00007ffff703d837 in QWidget::setContentsMargins (this=0x7fffffffda60, left=0, top=1, right=0, bottom=0) at /home/david/projects/qt5/qtbase/src/widgets/kernel/qwidget.cpp:7362
#27 0x00007fffea8c46e3 in Breeze::ToolsAreaManager::toolsAreaRect (this=0x555555e87400, window=0x7fffffffda60)
    at /home/david/projects/kde5/src/kde/workspace/breeze/kstyle/breezetoolsareamanager.cpp:69
#28 0x00007fffea898355 in Breeze::Style::drawWidgetPrimitive (this=0x555555e718d0, option=0x7fffffffc470, painter=0x7fffffffc5a0, widget=0x7fffffffda60)
    at /home/david/projects/kde5/src/kde/workspace/breeze/kstyle/breezestyle.cpp:965
#29 0x00007fffea8b748c in std::__invoke_impl<bool, bool (Breeze::Style::*&)(QStyleOption const*, QPainter*, QWidget const*) const, Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*> (__f=
    @0x7fffffffc348: (bool (Breeze::Style::*)(const Breeze::Style * const, const QStyleOption *, QPainter *, const QWidget *)) 0x7fffea898250 <Breeze::Style::drawWidgetPrimitive(QStyleOption const*, QPainter*, QWidget const*) const>, __t=..., __args=@0x7fffffffc110: 0x7fffffffda60, __args=@0x7fffffffc110: 0x7fffffffda60, __args=@0x7fffffffc110: 0x7fffffffda60)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/invoke.h:66
#30 0x00007fffea8b7351 in std::__invoke_r<bool, bool (Breeze::Style::*&)(QStyleOption const*, QPainter*, QWidget const*) const, Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*> (__fn=
    @0x7fffffffc348: (bool (Breeze::Style::*)(const Breeze::Style * const, const QStyleOption *, QPainter *, const QWidget *)) 0x7fffea898250 <Breeze::Style::drawWidgetPrimitive(QStyleOption const*, QPainter*, QWidget const*) const>, __args=@0x7fffffffc110: 0x7fffffffda60, __args=@0x7fffffffc110: 0x7fffffffda60, __args=@0x7fffffffc110: 0x7fffffffda60, 
    __args=@0x7fffffffc110: 0x7fffffffda60) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/invoke.h:141
#31 0x00007fffea8b71f1 in std::_Function_handler<bool (Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*), bool (Breeze::Style::*)(QStyleOption const*, QPainter*, QWidget const*) const>::_M_invoke(std::_Any_data const&, Breeze::Style const&, QStyleOption const*&&, QPainter*&&, QWidget const*&&) (__functor=..., 
    __args=@0x7fffffffc110: 0x7fffffffda60, __args=@0x7fffffffc110: 0x7fffffffda60, __args=@0x7fffffffc110: 0x7fffffffda60, __args=@0x7fffffffc110: 0x7fffffffda60)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/std_function.h:291
#32 0x00007fffea8b0e83 in std::function<bool (Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*)>::operator()(Breeze::Style const&, QStyleOption const*, QPainter*, QWidget const*) const (this=0x7fffffffc348, __args=0x7fffffffda60, __args=0x7fffffffda60, __args=0x7fffffffda60, __args=0x7fffffffda60)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/std_function.h:622
#33 0x00007fffea892f14 in Breeze::Style::drawPrimitive (this=0x555555e718d0, element=QStyle::PE_Widget, option=0x7fffffffc470, painter=0x7fffffffc5a0, widget=0x7fffffffda60)
    at /home/david/projects/kde5/src/kde/workspace/breeze/kstyle/breezestyle.cpp:948
#34 0x0000555555ad816a in ProxyStyle::drawPrimitive(QStyle::PrimitiveElement, QStyleOption const*, QPainter*, QWidget const*) const ()
#35 0x00007ffff702ec2a in QWidgetPrivate::paintBackground (this=0x555555ef0480, painter=0x7fffffffc5a0, rgn=..., flags=...)
    at /home/david/projects/qt5/qtbase/src/widgets/kernel/qwidget.cpp:2280
#36 0x00007ffff70370b2 in QWidgetPrivate::drawWidget (this=0x555555ef0480, pdev=0x55555636ae80, rgn=..., offset=..., flags=..., sharedPainter=0x0, repaintManager=0x555556745800)
    at /home/david/projects/qt5/qtbase/src/widgets/kernel/qwidget.cpp:5357



We *absolutely* must not perform a resize inside a paint function!
Comment 8 Bug Janitor Service 2021-01-28 14:48:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/breeze/-/merge_requests/73
Comment 9 David Redondo 2021-01-28 15:49:47 UTC
Git commit 0deecb4d57aef085b8eb0b8b24e916201bfa1f2c by David Redondo.
Committed on 28/01/2021 at 14:45.
Pushed by ngraham into branch 'master'.

Move QMainWindow contentMargins setting to polish

Never mutate a widget while painting! This causes recursive repaints and makes
prorgams crash. There is a reason why const_casts are discouraged.
FIXED-IN: 5.21

M  +6    -0    kstyle/breezestyle.cpp
M  +2    -11   kstyle/breezetoolsareamanager.cpp
M  +2    -2    kstyle/breezetoolsareamanager.h

https://invent.kde.org/plasma/breeze/commit/0deecb4d57aef085b8eb0b8b24e916201bfa1f2c
Comment 10 Nate Graham 2021-01-28 15:50:18 UTC
Git commit 6d3f235f4e757d4684f8fabd1d647615df55c0d6 by Nate Graham, on behalf of David Redondo.
Committed on 28/01/2021 at 15:50.
Pushed by ngraham into branch 'Plasma/5.21'.

Move QMainWindow contentMargins setting to polish

Never mutate a widget while painting! This causes recursive repaints and makes
prorgams crash. There is a reason why const_casts are discouraged.
FIXED-IN: 5.21


(cherry picked from commit 0deecb4d57aef085b8eb0b8b24e916201bfa1f2c)

M  +6    -0    kstyle/breezestyle.cpp
M  +2    -11   kstyle/breezetoolsareamanager.cpp
M  +2    -2    kstyle/breezetoolsareamanager.h

https://invent.kde.org/plasma/breeze/commit/6d3f235f4e757d4684f8fabd1d647615df55c0d6
Comment 11 David Redondo 2021-02-01 12:28:22 UTC
Reopen because commit was reverted
Comment 12 Janet Blackquill 2021-02-04 02:53:30 UTC
Git commit 03fb4b49008f1bcbf5feb685c2d542f3374b20e2 by Jan Blackquill.
Committed on 04/02/2021 at 02:50.
Pushed by cblack into branch 'master'.

[kstyle]: Don't attempt to adjust contentsMargins on QMainWindows

For most applications, this isn't necessary as they rarely draw in the top pixel,
and implementing this safely is problematic.

M  +1    -9    kstyle/breezetoolsareamanager.cpp
M  +1    -1    kstyle/breezetoolsareamanager.h

https://invent.kde.org/plasma/breeze/commit/03fb4b49008f1bcbf5feb685c2d542f3374b20e2
Comment 13 Janet Blackquill 2021-02-04 02:54:42 UTC
Git commit 7bd37a18d5695c748bfbf650023d63ca64869097 by Jan Blackquill.
Committed on 04/02/2021 at 02:54.
Pushed by cblack into branch 'Plasma/5.21'.

[kstyle]: Don't attempt to adjust contentsMargins on QMainWindows

For most applications, this isn't necessary as they rarely draw in the top pixel,
and implementing this safely is problematic.

M  +1    -9    kstyle/breezetoolsareamanager.cpp
M  +1    -1    kstyle/breezetoolsareamanager.h

https://invent.kde.org/plasma/breeze/commit/7bd37a18d5695c748bfbf650023d63ca64869097