Bug 292816 - Crash in Compact View when the view height is insufficient to show an item and a key is pressed
Summary: Crash in Compact View when the view height is insufficient to show an item an...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 2.0
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-29 18:29 UTC by Frank Reininghaus
Modified: 2012-01-30 09:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.8.1
Sentry Crash Report:


Attachments
Possible fix for the problem (1.06 KB, patch)
2012-01-29 18:30 UTC, Frank Reininghaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Reininghaus 2012-01-29 18:29:12 UTC
Application: dolphin (2.0)
KDE Platform Version: 4.8.00 (4.8.0) (Compiled from sources)
Qt Version: 4.8.0
Operating System: Linux 2.6.37.6-0.9-desktop x86_64
Distribution: "openSUSE 11.4 (x86_64)"

-- Information about the crash:
- What I was doing when the application crashed:

1. Switch to Compact View, reduce the icon size to the minimum.
2. Resize the Dolphin window such that the height is as small as possible (it may be necessary to remove the panels).
3. Increase the icon size to the maximum. Note that the items can not be shown fully because the view height is insufficient.
4. Press any key -> crash.

The problem is that KItemListView::scrollToItem() assumes that the bottom of the current item can only be lower than the view's bottom if the scroll orientation is Vertical (i.e., in Icons and Details View), but that is not the case in the situation described above. I'll attach a patch in a minute.

The crash can be reproduced every time.

-- Backtrace:
Application: Dolphin (dolphin), signal: Aborted
[Current thread is 1 (Thread 0x7f8584505760 (LWP 17809))]

Thread 3 (Thread 0x7f8575f83700 (LWP 17811)):
#0  0x00007f857ef2d5a3 in poll () from /lib64/libc.so.6
#1  0x00007f857b75f114 in ?? () from /lib64/libglib-2.0.so.0
#2  0x00007f857b75f650 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#3  0x00007f8581b6877c in QEventDispatcherGlib::processEvents (this=0x76e0f0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#4  0x00007f8581b293fe in QEventLoop::processEvents (this=0x7f8575f82d80, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f8581b29588 in QEventLoop::exec (this=0x7f8575f82d80, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f85819f5721 in QThread::exec (this=0x77ad50) at thread/qthread.cpp:501
#7  0x00007f8581b03fe4 in QInotifyFileSystemWatcherEngine::run (this=0x77ad50) at io/qfilesystemwatcher_inotify.cpp:248
#8  0x00007f85819f80a6 in QThreadPrivate::start (arg=0x77ad50) at thread/qthread_unix.cpp:298
#9  0x00007f8581738a3f in start_thread () from /lib64/libpthread.so.0
#10 0x00007f857ef3671d in clone () from /lib64/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f857541c700 (LWP 17813)):
#0  0x00007f857ef2fd13 in select () from /lib64/libc.so.6
#1  0x00007f8581afe3da in QProcessManager::run (this=0x7f8581ee67c0) at io/qprocess_unix.cpp:244
#2  0x00007f85819f80a6 in QThreadPrivate::start (arg=0x7f8581ee67c0) at thread/qthread_unix.cpp:298
#3  0x00007f8581738a3f in start_thread () from /lib64/libpthread.so.0
#4  0x00007f857ef3671d in clone () from /lib64/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f8584505760 (LWP 17809)):
[KCrash Handler]
#6  0x00007f857ee95ab5 in raise () from /lib64/libc.so.6
#7  0x00007f857ee96fb6 in abort () from /lib64/libc.so.6
#8  0x00007f85819eac88 in qt_message_output (msgType=QtFatalMsg, buf=0xc5b1f8 "ASSERT: \"scrollOrientation() == Qt::Vertical\" in file /home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/kitemviews/kitemlistview.cpp, line 515") at global/qglobal.cpp:2252
#9  0x00007f85819eae04 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7f8581bb0808 "ASSERT: \"%s\" in file %s, line %d", ap=0x7fff18ab7ca0) at global/qglobal.cpp:2298
#10 0x00007f85819eb672 in qFatal (msg=0x7f8581bb0808 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2481
#11 0x00007f85819ea83b in qt_assert (assertion=0x7f8583bee580 "scrollOrientation() == Qt::Vertical", file=0x7f8583bee530 "/home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/kitemviews/kitemlistview.cpp", line=515) at global/qglobal.cpp:1999
#12 0x00007f8583baa953 in KItemListView::scrollToItem (this=0x8bb250, index=1) at /home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/kitemviews/kitemlistview.cpp:515
#13 0x00007f8583b9b7bf in KItemListController::keyPressEvent (this=0x7d5e80, event=0x7fff18ab9ad0) at /home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/kitemviews/kitemlistcontroller.cpp:383
#14 0x00007f8583b9d635 in KItemListController::processEvent (this=0x7d5e80, event=0x7fff18ab9ad0, transform=...) at /home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/kitemviews/kitemlistcontroller.cpp:856
#15 0x00007f8583bab2fb in KItemListView::event (this=0x8bb250, event=0x7fff18ab9ad0) at /home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/kitemviews/kitemlistview.cpp:689
#16 0x00007f85806c7684 in QApplicationPrivate::notify_helper (this=0x62a580, receiver=0x8bb250, e=0x7fff18ab9ad0) at kernel/qapplication.cpp:4550
#17 0x00007f85806c4ca8 in QApplication::notify (this=0x7fff18abac10, receiver=0x8bb250, e=0x7fff18ab9ad0) at kernel/qapplication.cpp:3932
#18 0x00007f8582959091 in KApplication::notify (this=0x7fff18abac10, receiver=0x8bb250, event=0x7fff18ab9ad0) at /home/kde-4.8/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:311
#19 0x00007f8581b2bb99 in QCoreApplication::notifyInternal (this=0x7fff18abac10, receiver=0x8bb250, event=0x7fff18ab9ad0) at kernel/qcoreapplication.cpp:876
#20 0x00007f8583b99f89 in QCoreApplication::sendEvent (receiver=0x8bb250, event=0x7fff18ab9ad0) at /home/kde-4.8/qt/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#21 0x00007f8583b98876 in KItemListContainer::keyPressEvent (this=0x8c6630, event=0x7fff18ab9ad0) at /home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/kitemviews/kitemlistcontainer.cpp:110
#22 0x00007f858072d384 in QWidget::event (this=0x8c6630, event=0x7fff18ab9ad0) at kernel/qwidget.cpp:8397
#23 0x00007f8580bfe3d3 in QFrame::event (this=0x8c6630, e=0x7fff18ab9ad0) at widgets/qframe.cpp:557
#24 0x00007f8580caa3a3 in QAbstractScrollArea::event (this=0x8c6630, e=0x7fff18ab9ad0) at widgets/qabstractscrollarea.cpp:996
#25 0x00007f85806c7684 in QApplicationPrivate::notify_helper (this=0x62a580, receiver=0x8c6630, e=0x7fff18ab9ad0) at kernel/qapplication.cpp:4550
#26 0x00007f85806c506d in QApplication::notify (this=0x7fff18abac10, receiver=0x8c6630, e=0x7fff18ab9ad0) at kernel/qapplication.cpp:3991
#27 0x00007f8582959091 in KApplication::notify (this=0x7fff18abac10, receiver=0x8c6630, event=0x7fff18ab9ad0) at /home/kde-4.8/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:311
#28 0x00007f8581b2bb99 in QCoreApplication::notifyInternal (this=0x7fff18abac10, receiver=0x8c6630, event=0x7fff18ab9ad0) at kernel/qcoreapplication.cpp:876
#29 0x00007f85806c9eef in QCoreApplication::sendSpontaneousEvent (receiver=0x8c6630, event=0x7fff18ab9ad0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234
#30 0x00007f85806c79d7 in qt_sendSpontaneousEvent (receiver=0x8c6630, event=0x7fff18ab9ad0) at kernel/qapplication.cpp:5544
#31 0x00007f858079e71f in QKeyMapper::sendKeyEvent (keyWidget=0x8c6630, grab=false, type=QEvent::KeyPress, code=16777237, modifiers=..., text=..., autorepeat=false, count=1, nativeScanCode=116, nativeVirtualKey=65364, nativeModifiers=16) at kernel/qkeymapper_x11.cpp:1866
#32 0x00007f858079e424 in QKeyMapperPrivate::translateKeyEvent (this=0x66bd10, keyWidget=0x8c6630, event=0x7fff18aba7d0, grab=false) at kernel/qkeymapper_x11.cpp:1836
#33 0x00007f85807659f5 in QApplication::x11ProcessEvent (this=0x7fff18abac10, event=0x7fff18aba7d0) at kernel/qapplication_x11.cpp:3513
#34 0x00007f85807a07cc in x11EventSourceDispatch (s=0x62e750, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#35 0x00007f857b75ebd3 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#36 0x00007f857b75f3b0 in ?? () from /lib64/libglib-2.0.so.0
#37 0x00007f857b75f650 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#38 0x00007f8581b68759 in QEventDispatcherGlib::processEvents (this=0x60cf20, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#39 0x00007f85807a0b7a in QGuiEventDispatcherGlib::processEvents (this=0x60cf20, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#40 0x00007f8581b293fe in QEventLoop::processEvents (this=0x7fff18abab80, flags=...) at kernel/qeventloop.cpp:149
#41 0x00007f8581b29588 in QEventLoop::exec (this=0x7fff18abab80, flags=...) at kernel/qeventloop.cpp:204
#42 0x00007f8581b2c21a in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1148
#43 0x00007f85806c4892 in QApplication::exec () at kernel/qapplication.cpp:3811
#44 0x00007f85840cf696 in kdemain (argc=1, argv=0x7fff18abb188) at /home/kde-4.8/kde/src/KDE/kde-baseapps/dolphin/src/main.cpp:91
#45 0x0000000000400906 in main (argc=1, argv=0x7fff18abb188) at /home/kde-4.8/kde/build/KDE/kde-baseapps/dolphin/src/dolphin_dummy.cpp:3

Reported using DrKonqi
Comment 1 Frank Reininghaus 2012-01-29 18:30:17 UTC
Created attachment 68309 [details]
Possible fix for the problem
Comment 2 Peter Penz 2012-01-30 08:26:46 UTC
Thanks Frank! The patch looks good, please just push it to master + 4.8
Comment 3 Peter Penz 2012-01-30 08:32:08 UTC
Ah, just had a second look: Probably this would make the code more maintainable:

    if (!viewGeometry.contains(currentRect)) {
        qreal newOffset = scrollOffset();
        if (scrollOrientation() == Qt::Vertical) {
           if (currentRect.top() < viewGeometry.top()) {
                newOffset += currentRect.top() - viewGeometry.top();
           } else if (currentRect.bottom() > viewGeometry.bottom()) {
                newOffset += currentRect.bottom() - viewGeometry.bottom();
           }
        } else {
            if (currentRect.left() < viewGeometry.left()) {
                newOffset += currentRect.left() - viewGeometry.left();
            } else if (currentRect.right() > viewGeometry.right()) {
                newOffset += currentRect.right() - viewGeometry.right();
            }
        }

        if (newOffset != scrollOffset()) {
            emit scrollTo(newOffset);
        }
    }

Just a suggestion :-)
Comment 4 Frank Reininghaus 2012-01-30 09:08:51 UTC
Git commit f5ecaee9c40c940fe8e1bf4a7d50fe0b18e1932b by Frank Reininghaus.
Committed on 30/01/2012 at 10:07.
Pushed by freininghaus into branch 'KDE/4.8'.

Fix crash in Compact View if view height is smaller then item height
FIXED-IN: 4.8.1

M  +9    -11   dolphin/src/kitemviews/kitemlistview.cpp

http://commits.kde.org/kde-baseapps/f5ecaee9c40c940fe8e1bf4a7d50fe0b18e1932b
Comment 5 Frank Reininghaus 2012-01-30 09:12:17 UTC
Git commit 61cd43249f4ea928bf0a591e466fea9436e2e304 by Frank Reininghaus.
Committed on 30/01/2012 at 10:07.
Pushed by freininghaus into branch 'master'.

Fix crash in Compact View if view height is smaller then item height
FIXED-IN: 4.8.1
(cherry picked from commit f5ecaee9c40c940fe8e1bf4a7d50fe0b18e1932b)

M  +9    -11   dolphin/src/kitemviews/kitemlistview.cpp

http://commits.kde.org/kde-baseapps/61cd43249f4ea928bf0a591e466fea9436e2e304