Bug 247366

Summary: "Window Pack Left (or some other direction)" crashes the current application
Product: [Plasma] kwin Reporter: Maxime Gamboni <tendays-kde>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: crash CC: cfeck
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Maxime Gamboni 2010-08-11 13:35:39 UTC
Version:           unspecified (using KDE 4.5.0) 
OS:                Linux

This bug appeared after upgrading to kde 4.5, using the kubuntu backports.

I set up keyboard shortcuts (meta+direction for Window Pack direction) to move windows around. When I try to move a kde window, the application owning that window crashes. When I try to move a non-kde window (I only tried xterm), it has no effect (the window doesn't move, and the application doesn't crash either).

Reproducible: Always

Steps to Reproduce:
1. Set up a keyboard shortcut to "window pack right".
2. Select a window of a kde application (let's say konversation).
3. Type the keyboard shortcut set in step 1.

Actual Results:  
The konversation window disappears, and konversation (or whatever application owns the selected window) crashes with a segfault.

Expected Results:  
The window should have moved to the right up to the next window or screen border as it used to do up to KDE 4.4.

Here is a stacktrace when doing that on konversation. Let me stress, however, that this is *not* a konversation bug, it happens with all kde applications I tried. I have *not* activated tiling windows, if that is relevant.

Application: Konversation (konversation), signal: Segmentation fault
[KCrash Handler]
#7  0x05d730ba in QX11PaintEngine::drawPixmap (this=0x9ad0bb8, r=..., px=..., _sr=...) at painting/qpaintengine_x11.cpp:1924
#8  0x05c97f05 in QPaintEngine::drawImage (this=0x9ad0bb8, r=..., image=..., sr=..., flags=...) at painting/qpaintengine.cpp:624
#9  0x05d71279 in QX11PaintEngine::drawImage (this=0x9ad0bb8, r=..., image=..., sr=..., flags=...) at painting/qpaintengine_x11.cpp:1898
#10 0x05cb0d08 in QPainterPrivate::draw_helper (this=0x9d5ca30, originalPath=..., op=<value optimized out>) at painting/qpainter.cpp:488
#11 0x05cb6b49 in QPainter::drawPath (this=0xbf960a3c, path=...) at painting/qpainter.cpp:3372
#12 0x05cb929c in QPainter::drawRoundedRect (this=0xbf960a3c, rect=..., xRadius=2, yRadius=2, mode=Qt::AbsoluteSize) at painting/qpainter.cpp:4152
#13 0x01bf0d4c in ?? () from /usr/lib/kde4/plugins/styles/oxygen.so
#14 0x01bf1eb0 in ?? () from /usr/lib/kde4/plugins/styles/oxygen.so
#15 0x01be1b75 in ?? () from /usr/lib/kde4/plugins/styles/oxygen.so
#16 0x011ba686 in KStyle::drawControl (this=0xbf960a3c, element=QStyle::CE_ScrollBarSlider, option=0xbf95f408, p=0xbf960a3c, widget=0x9cd4720) at ../../kdeui/kernel/kstyle.cpp:2266
#17 0x01bf67bf in ?? () from /usr/lib/kde4/plugins/styles/oxygen.so
#18 0x05eacddc in QCommonStyle::drawComplexControl (this=0x95b7348, cc=QStyle::CC_ScrollBar, opt=0x95b7348, p=0xbf960a3c, widget=0x9cd4720) at styles/qcommonstyle.cpp:3237
#19 0x011b699c in KStyle::drawComplexControl (this=0x95b7348, cc=QStyle::CC_ScrollBar, opt=0xbf9609d4, p=0xbf960a3c, w=0x9cd4720) at ../../kdeui/kernel/kstyle.cpp:3597
#20 0x01be07c8 in ?? () from /usr/lib/kde4/plugins/styles/oxygen.so
#21 0x06011658 in QScrollBar::paintEvent (this=0xbf9609d4) at widgets/qscrollbar.cpp:566
#22 0x05b94b06 in QWidget::event (this=0x9cd4720, event=0xbf961034) at kernel/qwidget.cpp:8303
#23 0x05f63e84 in QAbstractSlider::event (this=0x9cd4720, e=0xbf961034) at widgets/qabstractslider.cpp:942
#24 0x06012087 in QScrollBar::event (this=0x9cd4720, event=0xbf961034) at widgets/qscrollbar.cpp:546
#25 0x05b370cc in QApplicationPrivate::notify_helper (this=0x9571ee0, receiver=0x9cd4720, e=0xbf961034) at kernel/qapplication.cpp:4389
#26 0x05b3d1b9 in QApplication::notify (this=0xbf9647c4, receiver=0x9cd4720, e=0xbf961034) at kernel/qapplication.cpp:4354
#27 0x011a682a in KApplication::notify (this=0xbf9647c4, receiver=0x9cd4720, event=0xbf961034) at ../../kdeui/kernel/kapplication.cpp:310
#28 0x0766c96b in QCoreApplication::notifyInternal (this=0xbf9647c4, receiver=0x9cd4720, event=0xbf961034) at kernel/qcoreapplication.cpp:732
#29 0x05b9be56 in QCoreApplication::sendSpontaneousEvent (this=0x9cd4960, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#30 QWidgetPrivate::drawWidget (this=0x9cd4960, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5390
#31 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9cd4828, pdev=0x9812dac, siblings=..., index=1, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#32 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9cd4828, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#33 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9cd3c58, pdev=0x9812dac, siblings=..., index=18, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#34 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9cd3c58, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#35 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9cd36e0, pdev=0x9812dac, siblings=..., index=2, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#36 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9cd36e0, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#37 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9cd2c38, pdev=0x9812dac, siblings=..., index=2, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#38 0x05b9cace in QWidgetPrivate::paintSiblingsRecursive (this=0x9cd2c38, pdev=0x9812dac, siblings=..., index=3, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5584
#39 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9cd2c38, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#40 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9cbdfc8, pdev=0x9812dac, siblings=..., index=0, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#41 0x05b9cace in QWidgetPrivate::paintSiblingsRecursive (this=0x9cbdfc8, pdev=0x9812dac, siblings=..., index=2, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5584
#42 0x05b9cace in QWidgetPrivate::paintSiblingsRecursive (this=0x9cbdfc8, pdev=0x9812dac, siblings=..., index=3, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5584
#43 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9cbdfc8, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#44 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9cbe3d8, pdev=0x9812dac, siblings=..., index=1, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#45 0x05b9cace in QWidgetPrivate::paintSiblingsRecursive (this=0x9cbe3d8, pdev=0x9812dac, siblings=..., index=4, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5584
#46 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9cbe3d8, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#47 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9669c88, pdev=0x9812dac, siblings=..., index=4, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#48 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9669c88, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#49 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9669a28, pdev=0x9812dac, siblings=..., index=0, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#50 0x05b9cace in QWidgetPrivate::paintSiblingsRecursive (this=0x9669a28, pdev=0x9812dac, siblings=..., index=1, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5584
#51 0x05b9cace in QWidgetPrivate::paintSiblingsRecursive (this=0x9669a28, pdev=0x9812dac, siblings=..., index=3, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5584
#52 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9669a28, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#53 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9669408, pdev=0x9812dac, siblings=..., index=2, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#54 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9669408, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#55 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x9669178, pdev=0x9812dac, siblings=..., index=2, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#56 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x9669178, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#57 0x05b9cc95 in QWidgetPrivate::paintSiblingsRecursive (this=0x966f698, pdev=0x9812dac, siblings=..., index=5, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5597
#58 0x05b9cace in QWidgetPrivate::paintSiblingsRecursive (this=0x966f698, pdev=0x9812dac, siblings=..., index=108, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x9812e78)
    at kernel/qwidget.cpp:5584
#59 0x05b9bba5 in QWidgetPrivate::drawWidget (this=0x966f698, pdev=0x9812dac, rgn=..., offset=..., flags=<value optimized out>, sharedPainter=0x0, backingStore=0x9812e78) at kernel/qwidget.cpp:5443
#60 0x05d8ccf0 in QWidgetBackingStore::sync (this=0x9812e78) at painting/qbackingstore.cpp:1328
#61 0x05b8e0b3 in QWidgetPrivate::syncBackingStore (this=0x966f698) at kernel/qwidget.cpp:1775
#62 0x05bbc8fe in QETWidget::translateConfigEvent (this=0x96683d0, event=0xbf96442c) at kernel/qapplication_x11.cpp:5291
#63 0x05bc965f in QApplication::x11ProcessEvent (this=0xbf9647c4, event=0xbf96442c) at kernel/qapplication_x11.cpp:3441
#64 0x05bf8b3a in x11EventSourceDispatch (s=0x9578fb0, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#65 0x04b685e5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#66 0x04b6c2d8 in ?? () from /lib/libglib-2.0.so.0
#67 0x04b6c4b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#68 0x0769b195 in QEventDispatcherGlib::processEvents (this=0x95704b8, flags=...) at kernel/qeventdispatcher_glib.cpp:412
#69 0x05bf83b5 in QGuiEventDispatcherGlib::processEvents (this=0x95704b8, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#70 0x0766b419 in QEventLoop::processEvents (this=0xbf964724, flags=) at kernel/qeventloop.cpp:149
#71 0x0766b89a in QEventLoop::exec (this=0xbf964724, flags=...) at kernel/qeventloop.cpp:201
#72 0x0766fe4f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
#73 0x05b35ef7 in QApplication::exec () at kernel/qapplication.cpp:3665
#74 0x080a7148 in _start ()
Comment 1 Maxime Gamboni 2010-08-11 13:41:42 UTC
This may be a duplicate of https://bugs.kde.org/show_bug.cgi?id=241049 although that bug reports huge windows and this one has a crash.

Shall I close this as a duplicate anyway?
Comment 2 Christoph Feck 2010-08-11 13:49:51 UTC
Bug 241049 comment #3 states that something starts eating lots of RAM.

This crash could be caused by video drivers failing to allocate memory to convert images to pixmaps and Qt fails to handle that case. See bug 230490. It is nice to have a reproducable test case for the bug.

Are you able to compile Qt from source? If yes, I will prepare a patch so that you can test.
Comment 3 Maxime Gamboni 2010-08-11 14:17:08 UTC
Yes I should be able to. I have these (ubuntu) packages that seem to provide the core of Qt, if you can guess/tell me which one your patch will apply to, I'll grab the corresponding sources. (Although, if I understand correctly, this will fix the crash itself, but still won't make the "pack" feature work, correct? Anyway, that *is* a step to the right direction)

ii  libqt3-mt                                  3:3.3.8-b-6ubuntu2                              Qt GUI Library (Threaded runtime version), V
rc  libqt4-assistant                           4:4.6.2-0ubuntu5                                Qt 4 assistant module
ii  libqt4-core                                4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              transitional package for Qt 4 core non-GUI r
ii  libqt4-dbg                                 4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 library debugging symbols
ii  libqt4-dbus                                4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 D-Bus module
ii  libqt4-declarative                         4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 Declarative module
ii  libqt4-designer                            4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 designer module
ii  libqt4-dev                                 4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 development files
ii  libqt4-help                                4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 help module
ii  libqt4-multimedia                          4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 Multimedia module
ii  libqt4-network                             4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 network module
ii  libqt4-opengl                              4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 OpenGL module
ii  libqt4-opengl-dev                          4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 OpenGL library development files
ii  libqt4-qt3support                          4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 3 compatibility library for Qt 4
ii  libqt4-script                              4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 script module
ii  libqt4-scripttools                         4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 script tools module
ii  libqt4-sql                                 4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 SQL module
ii  libqt4-sql-mysql                           4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 MySQL database driver
ii  libqt4-sql-sqlite                          4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 SQLite 3 database driver
ii  libqt4-svg                                 4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 SVG module
ii  libqt4-test                                4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 test module
ii  libqt4-webkit                              4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              transitional package for Qt 4 WebKit module
ii  libqt4-xml                                 4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 XML module
ii  libqt4-xmlpatterns                         4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 XML patterns module
ii  libqtcore4                                 4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 core module
ii  libqtgui4                                  4:4.7.0~beta2-0ubuntu3~lucid1~ppa4              Qt 4 GUI module

There are some more with "qt" in the name but they don't seem to be part of the core libraries.

Thanks.
Comment 4 Christoph Feck 2010-08-11 15:02:22 UTC
You are right, there are two bugs.

This bug is about broken pack window functions; those create very large windows. Of course this one has to be fixed by KWin developers separately.

The other bug is bug 230490 which is indeed a Qt bug failing to handle those large windows correctly and causing a crash. We have long been getting bug reports for this one, but we had no test case. And now I can abuse this bug for the test case ;)

I will add the patch to bug 230490. Qt comes in a single source package, you cannot compile modules separately. You could ask on IRC or in a forum when you need help recreating Qt with the patch.

*** This bug has been marked as a duplicate of bug 241049 ***
Comment 5 Maxime Gamboni 2010-08-12 12:46:25 UTC
I don't like bypassing the dpkg package system. I'll first try going the "apt-get source" way, but if that doesn't work I'll get the sources directly.

Will report back when I have results.
Comment 6 Maxime Gamboni 2010-08-14 14:54:24 UTC
All right so I wrote a long report in here, and then thought I'd try and see what happens if I try "packing" a Skype window, given that it's Qt but not kde, but that made all of X unresponsive so I lost my report. Anyway the point was, I applied your patch on qt 4.7.0 and I no longer get segfaults, but a variety of other behaviours instead, such as the app taking 100% cpu until killed, or X throwing an ABORT because of insufficient resources at the application, or (most of the time) just nothing at all happening. I suppose that means "your" bug is fixed, and now let's hope some kwin expert finds how to fix "mine" :)

Thanks