Bug 259333 - KExtendableItemDelegate crashes in extendRect() on initial paint
Summary: KExtendableItemDelegate crashes in extendRect() on initial paint
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Andreas Hartmetz
URL:
Keywords:
: 265548 271201 280941 281286 282176 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-09 15:54 UTC by Jonathan Thomas
Modified: 2014-07-06 15:19 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
New crash information added by DrKonqi (11.65 KB, text/plain)
2011-09-25 07:30 UTC, Vladimir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Thomas 2010-12-09 15:54:29 UTC
Version:           unspecified (using KDE 4.5.85) 
OS:                Linux

I'm using the KExtendableItemDelegate in the Muon Software Center. I have a reproducible crash that after my list view is completely deleted and a new one is created, I get a crash the first time I try to extend an extender.

I've checked using kDebug() and have confirmed that the extender pointer is valid. (I even used a function with the pointer right before extending to check if the pointer was dangling or not) For some reason it seems to crash even though the extender is valid.

Here is a "bt full" backtrace from gdb, going back to the first paintSiblingsRecursive() call.


#0  0xb7dcd383 in KExtendableItemDelegate::extenderRect (this=0x8811588, 
    extender=0x890acc8, option=..., index=...)
    at ../../kdeui/itemviews/kextendableitemdelegate.cpp:313
        indentation = <value optimized out>
        rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 66}
#1  0xb7dce642 in KExtendableItemDelegate::paint (this=0x8811588, painter=0xbfffc3bc, 
    option=..., index=...) at ../../kdeui/itemviews/kextendableitemdelegate.cpp:277
        extOption = {<QStyleOptionViewItemV3> = {<QStyleOptionViewItemV2> = {<QStyleOptionViewItem> = {<QStyleOption> = {version = 4, type = 12, state = {i = 106753}, 
                  direction = Qt::LeftToRight, rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 66}, 
                  fontMetrics = {d = {d = 0x8150c80}}, palette = {static staticMetaObject = 
    {d = {superdata = 0x0, stringdata = 0xb767e140 "QPalette", data = 0xb767e280, 
                        extradata = 0x0}}, d = 0x811d598, current_group = 0, 
                    resolve_mask = 0}}, displayAlignment = {i = 129}, 
                decorationAlignment = {i = 132}, textElideMode = Qt::ElideRight, 
                decorationPosition = QStyleOptionViewItem::Left, decorationSize = {wd = 16, 
                  ht = 16}, font = {static staticMetaObject = {d = {superdata = 0x0, 
                      stringdata = 0xb767f520 "QFont", data = 0xb767f600, 
                      extradata = 0x0}}, d = {d = 0x8150c80}, resolve_mask = 0}, 
                showDecorationSelected = true}, features = {i = 0}}, locale = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb6b1c2c0 "QLocale", data = 0xb6b1d460, extradata = 0x0}}, {
                v = 0x10144, p = {index = 324, numberOptions = 1}}}, widget = 0x89017b0}, 
          index = {r = 0, c = 0, p = 0x87cf970, m = 0x899a738}, checkState = Qt::Unchecked, 
          icon = {d = 0x0}, text = {static null = {<No data fields>}, static shared_null = {
              ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x809304a, clean = 0, 
              simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, 
              array = {0}}, static shared_empty = {ref = {_q_value = 52}, alloc = 0, 
              size = 0, data = 0xb6b884b2, clean = 0, simpletext = 0, righttoleft = 0, 
              asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x8093038, 
            static codecForCStrings = 0x0}, 
          viewItemPosition = QStyleOptionViewItemV4::OnlyOne, backgroundBrush = {d = {
              d = 0x80f9dc0}}}
        indicatorX = 0
        indicatorOption = {<QStyleOptionViewItemV3> = {<QStyleOptionViewItemV2> = {<QStyleOptionViewItem> = {<QStyleOption> = {version = 4, type = 12, state = {i = 106753}, 
                  direction = Qt::LeftToRight, rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 66}, 
                  fontMetrics = {d = {d = 0x8150c80}}, palette = {
                    static staticMetaObject = {d = {superdata = 0x0, 
                        stringdata = 0xb767e140 "QPalette", data = 0xb767e280, 
                        extradata = 0x0}}, d = 0x811d598, current_group = 0, 
                    resolve_mask = 0}}, displayAlignment = {i = 129}, 
                decorationAlignment = {i = 132}, textElideMode = Qt::ElideRight, 
                decorationPosition = QStyleOptionViewItem::Left, decorationSize = {wd = 16, 
                  ht = 16}, font = {static staticMetaObject = {d = {superdata = 0x0, 
                      stringdata = 0xb767f520 "QFont", data = 0xb767f600, 
                      extradata = 0x0}}, d = {d = 0x8150c80}, resolve_mask = 0}, 
                showDecorationSelected = true}, features = {i = 0}}, locale = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb6b1c2c0 "QLocale", data = 0xb6b1d460, extradata = 0x0}}, {
                v = 0x10144, p = {index = 324, numberOptions = 1}}}, widget = 0x89017b0}, 
          index = {r = 0, c = 0, p = 0x87cf970, m = 0x899a738}, checkState = Qt::Unchecked, 
          icon = {d = 0x0}, text = {static null = {<No data fields>}, static shared_null = {
              ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x809304a, clean = 0, 
              simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, 
              array = {0}}, static shared_empty = {ref = {_q_value = 52}, alloc = 0, 
              size = 0, data = 0xb6b884b2, clean = 0, simpletext = 0, righttoleft = 0, 
              asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x8093038, 
            static codecForCStrings = 0x0}, 
          viewItemPosition = QStyleOptionViewItemV4::Beginning, backgroundBrush = {d = {
              d = 0x80f9dc0}}}
        itemOption = {<QStyleOptionViewItemV3> = {<QStyleOptionViewItemV2> = {<QStyleOptionViewItem> = {<QStyleOption> = {version = 4, type = 12, state = {i = 106753}, 
                  direction = Qt::LeftToRight, rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 66}, 
                  fontMetrics = {d = {d = 0x8150c80}}, palette = {
                    static staticMetaObject = {d = {superdata = 0x0, 
                        stringdata = 0xb767e140 "QPalette", data = 0xb767e280, 
                        extradata = 0x0}}, d = 0x811d598, current_group = 0, 
                    resolve_mask = 0}}, displayAlignment = {i = 129}, 
                decorationAlignment = {i = 132}, textElideMode = Qt::ElideRight, 
                decorationPosition = QStyleOptionViewItem::Left, decorationSize = {wd = 16, 
                  ht = 16}, font = {static staticMetaObject = {d = {superdata = 0x0, 
                      stringdata = 0xb767f520 "QFont", data = 0xb767f600, 
                      extradata = 0x0}}, d = {d = 0x8150c80}, resolve_mask = 0}, 
                showDecorationSelected = true}, features = {i = 0}}, locale = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb6b1c2c0 "QLocale", data = 0xb6b1d460, extradata = 0x0}}, {
                v = 0x10144, p = {index = 324, numberOptions = 1}}}, widget = 0x89017b0}, 
          index = {r = 0, c = 0, p = 0x87cf970, m = 0x899a738}, checkState = Qt::Unchecked, 
          icon = {d = 0x0}, text = {static null = {<No data fields>}, static shared_null = {
              ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x809304a, clean = 0, 
              simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, 
              array = {0}}, static shared_empty = {ref = {_q_value = 52}, alloc = 0, 
              size = 0, data = 0xb6b884b2, clean = 0, simpletext = 0, righttoleft = 0, 
              asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x8093038, 
            static codecForCStrings = 0x0}, 
          viewItemPosition = QStyleOptionViewItemV4::Beginning, backgroundBrush = {d = {
              d = 0x80f9dc0}}}
        extenderHeight = 33
        indicatorY = 0
        showExtensionIndicator = false
        cachedRow = 0
        parentIndex = {r = -1, c = -1, p = 0x0, m = 0x0}
        cachedStateTick = 2
        cachedParentIndex = {r = -1, c = -1, p = 0x0, m = 0x0}
        extender = 0x890acc8
        row = 0
#2  0x08069ed1 in ApplicationDelegate::paint (this=0x8811588, painter=0xbfffc3bc, 
    option=..., index=...)
    at /home/jonathan/src/muon/installer/ApplicationModel/ApplicationDelegate.cpp:90
        rect = {x1 = 16, y1 = 135597184, x2 = 0, y2 = -1224209664}
        p = {static staticMetaObject = {d = {superdata = 0x0, 
              stringdata = 0xb767f1a0 "QPainter", data = 0xb767f240, extradata = 0x0}}, 
          d_ptr = {d = 0x0}}
        opa = <value optimized out>
        style = 0x812d490
        local_option_title = {<QStyleOption> = {version = 20, type = 146267888, state = {
              i = 19}, direction = 3075647488, rect = {x1 = -1, y1 = 143768120, x2 = 0, 
              y2 = 0}, fontMetrics = {d = {d = 0x8db70c0}}, palette = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb767e140 "QPalette", data = 0xb767e280, extradata = 0x0}}, 
              d = 0xffffffff, current_group = 0, resolve_mask = 0}}, displayAlignment = {
            i = 2}, decorationAlignment = {i = 12}, textElideMode = 65537, 
          decorationPosition = QStyleOptionViewItem::Left, decorationSize = {wd = 0, 
            ht = 0}, font = {static staticMetaObject = {d = {superdata = 0x0, 
                stringdata = 0xb767f520 "QFont", data = 0xb767f600, extradata = 0x0}}, d = {
              d = 0xffffffff}, resolve_mask = 4294967295}, showDecorationSelected = 128}
        overlays = {<QList<QString>> = {{p = {static shared_null = {ref = {_q_value = 1}, 
                  alloc = 0, begin = 0, end = 0, sharable = 1, array = {0x0}}, 
                d = 0xffffffff}, d = 0xffffffff}}, <No data fields>}
        leftCount = <value optimized out>
        top = 144287544
        width = <value optimized out>
        foregroundColor = {cspec = 132, ct = {argb = {alpha = 1, red = 0, green = 0, 
              blue = 0, pad = 16}, ahsv = {alpha = 1, hue = 0, saturation = 0, value = 0, 
              pad = 16}, acmyk = {alpha = 1, cyan = 0, magenta = 0, yellow = 0, 
              black = 16}, ahsl = {alpha = 1, hue = 0, saturation = 0, lightness = 0, 
              pad = 16}, array = {1, 0, 0, 0, 16}}}
        iconSize = <value optimized out>
        textWidth = <value optimized out>
        itemHeight = <value optimized out>
        topTextHeight = <value optimized out>
        leftToRight = true
        local_option_normal = {<QStyleOption> = {version = 143767552, type = 171390010, 
            state = {i = 1031}, direction = Qt::LeftToRight, rect = {x1 = 148598976, 
              y1 = 135110800, x2 = 0, y2 = 0}, fontMetrics = {d = {d = 0x0}}, palette = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb767e140 "QPalette", data = 0xb767e280, extradata = 0x0}}, 
              d = 0x0, current_group = 0, resolve_mask = 0}}, displayAlignment = {i = 0}, 
          decorationAlignment = {i = 143768120}, textElideMode = 144911456, 
          decorationPosition = 66, decorationSize = {wd = 0, ht = 602240}, font = {
            static staticMetaObject = {d = {superdata = 0x0, 
                stringdata = 0xb767f520 "QFont", data = 0xb767f600, extradata = 0x0}}, d = {
              d = 0x8696400}, resolve_mask = 1}, showDecorationSelected = false}
        pixmap = {<QPaintDevice> = {_vptr.QPaintDevice = 0xbfffbf20, painters = 43848}, 
          data = {d = 0x8c4acf0}}
        opt = {<QStyleOptionViewItemV3> = {<QStyleOptionViewItemV2> = {<QStyleOptionViewItem> = {<QStyleOption> = {version = 4, type = 12, state = {i = 106753}, 
                  direction = Qt::LeftToRight, rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 66}, 
                  fontMetrics = {d = {d = 0x8150c80}}, palette = {
                    static staticMetaObject = {d = {superdata = 0x0, 
                        stringdata = 0xb767e140 "QPalette", data = 0xb767e280, 
                        extradata = 0x0}}, d = 0x811d598, current_group = 0, 
                    resolve_mask = 0}}, displayAlignment = {i = 129}, 
                decorationAlignment = {i = 132}, textElideMode = Qt::ElideRight, 
                decorationPosition = QStyleOptionViewItem::Left, decorationSize = {wd = 16, 
                  ht = 16}, font = {static staticMetaObject = {d = {superdata = 0x0, 
                      stringdata = 0xb767f520 "QFont", data = 0xb767f600, 
                      extradata = 0x0}}, d = {d = 0x8150c80}, resolve_mask = 0}, 
                showDecorationSelected = true}, features = {i = 0}}, locale = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb6b1c2c0 "QLocale", data = 0xb6b1d460, extradata = 0x0}}, {
                v = 0x10144, p = {index = 324, numberOptions = 1}}}, widget = 0x89017b0}, 
          index = {r = -1, c = -1, p = 0x0, m = 0x0}, checkState = Qt::Unchecked, icon = {
            d = 0x0}, text = {static null = {<No data fields>}, static shared_null = {
              ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x809304a, clean = 0, 
              simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, 
              array = {0}}, static shared_empty = {ref = {_q_value = 52}, alloc = 0, 
              size = 0, data = 0xb6b884b2, clean = 0, simpletext = 0, righttoleft = 0, 
              asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x8093038, 
            static codecForCStrings = 0x0}, 
          viewItemPosition = QStyleOptionViewItemV4::OnlyOne, backgroundBrush = {d = {
              d = 0x80f9dc0}}}
        left = <value optimized out>
        ratingPainter = {d = 0x0}
        iconMode = <value optimized out>
        icon = {<QIcon> = {d = 0xbfffc12c}, d = 0xb6a60d01}
#3  0xb74e2664 in QTreeView::drawRow (this=0x89017b0, painter=0xbfffc3bc, option=..., 
    index=...) at itemviews/qtreeview.cpp:1678
        headerSection = 0
        nextLogicalSection = <value optimized out>
        prevLogicalSection = <value optimized out>
        currentLogicalSection = <value optimized out>
        parent = {r = -1, c = -1, p = 0x0, m = 0x0}
        spanning = false
        widgetHasFocus = true
        columnCount = 1
        reverse = false
        right = 0
        alternate = true
        indexWidgetHasFocus = false
        modelIndex = {r = 0, c = 0, p = 0x87cf970, m = 0x899a738}
        y = 1
        logicalIndices = {{d = 0x8369090, p = 0x8369090}}
        d = 0x8b7def0
        left = 779
        currentRowHasFocus = false
        width = 779
        height = <value optimized out>
        position = 0
        opt = {<QStyleOptionViewItemV3> = {<QStyleOptionViewItemV2> = {<QStyleOptionViewItem> = {<QStyleOption> = {version = 4, type = 12, state = {i = 106753}, 
                  direction = Qt::LeftToRight, rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 66}, 
                  fontMetrics = {d = {d = 0x8150c80}}, palette = {
                    static staticMetaObject = {d = {superdata = 0x0, 
                        stringdata = 0xb767e140 "QPalette", data = 0xb767e280, 
                        extradata = 0x0}}, d = 0x811d598, current_group = 0, 
                    resolve_mask = 0}}, displayAlignment = {i = 129}, 
                decorationAlignment = {i = 132}, textElideMode = Qt::ElideRight, 
                decorationPosition = QStyleOptionViewItem::Left, decorationSize = {wd = 16, 
                  ht = 16}, font = {static staticMetaObject = {d = {superdata = 0x0, 
                      stringdata = 0xb767f520 "QFont", data = 0xb767f600, 
                      extradata = 0x0}}, d = {d = 0x8150c80}, resolve_mask = 0}, 
                showDecorationSelected = true}, features = {i = 0}}, locale = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb6b1c2c0 "QLocale", data = 0xb6b1d460, extradata = 0x0}}, {
                v = 0x10144, p = {index = 324, numberOptions = 1}}}, widget = 0x89017b0}, 
          index = {r = -1, c = -1, p = 0x0, m = 0x0}, checkState = Qt::Unchecked, icon = {
            d = 0x0}, text = {static null = {<No data fields>}, static shared_null = {
              ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x809304a, clean = 0, 
              simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, 
              array = {0}}, static shared_empty = {ref = {_q_value = 52}, alloc = 0, 
              size = 0, data = 0xb6b884b2, clean = 0, simpletext = 0, righttoleft = 0, 
              asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x8093038, 
            static codecForCStrings = 0x0}, 
          viewItemPosition = QStyleOptionViewItemV4::OnlyOne, backgroundBrush = {d = {
              d = 0x80f9dc0}}}
        current = {r = 0, c = 0, p = 0x87cf970, m = 0x899a738}
        enabled = true
        allColumnsShowFocus = false
        hoverRow = <value optimized out>
        header = 0x8db0148
        hover = {r = 0, c = 0, p = 0x87cf970, m = 0x899a738}
        logicalIndexBeforeLeft = -1
        logicalIndexAfterRight = -1
#4  0xb74e54b2 in QTreeView::drawTree (this=0x89017b0, painter=0xbfffc3bc, region=...)
    at itemviews/qtreeview.cpp:1441
        itemHeight = <value optimized out>
        area = {x1 = 0, y1 = 0, x2 = 778, y2 = 481}
        i = 0
        y = <value optimized out>
        a = <value optimized out>
        d = 0x8b7def0
        viewItems = {{d = 0x8a32c60, p = 0x8a32c60}}
        option = {<QStyleOptionViewItemV3> = {<QStyleOptionViewItemV2> = {<QStyleOptionViewItem> = {<QStyleOption> = {version = 4, type = 12, state = {i = 65537}, 
                  direction = Qt::LeftToRight, rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 66}, 
                  fontMetrics = {d = {d = 0x8150c80}}, palette = {
                    static staticMetaObject = {d = {superdata = 0x0, 
                        stringdata = 0xb767e140 "QPalette", data = 0xb767e280, 
                        extradata = 0x0}}, d = 0x811d598, current_group = 0, 
                    resolve_mask = 0}}, displayAlignment = {i = 129}, 
                decorationAlignment = {i = 132}, textElideMode = Qt::ElideRight, 
                decorationPosition = QStyleOptionViewItem::Left, decorationSize = {wd = 16, 
                  ht = 16}, font = {static staticMetaObject = {d = {superdata = 0x0, 
                      stringdata = 0xb767f520 "QFont", data = 0xb767f600, 
                      extradata = 0x0}}, d = {d = 0x8150c80}, resolve_mask = 0}, 
                showDecorationSelected = false}, features = {i = 0}}, locale = {
              static staticMetaObject = {d = {superdata = 0x0, 
                  stringdata = 0xb6b1c2c0 "QLocale", data = 0xb6b1d460, extradata = 0x0}}, {
                v = 0x10144, p = {index = 324, numberOptions = 1}}}, widget = 0x89017b0}, 
          index = {r = -1, c = -1, p = 0x0, m = 0x0}, checkState = Qt::Unchecked, icon = {
            d = 0x0}, text = {static null = {<No data fields>}, static shared_null = {
              ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x809304a, clean = 0, 
              simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, 
              array = {0}}, static shared_empty = {ref = {_q_value = 52}, alloc = 0, 
              size = 0, data = 0xb6b884b2, clean = 0, simpletext = 0, righttoleft = 0, 
              asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x8093038, 
            static codecForCStrings = 0x0}, 
          viewItemPosition = QStyleOptionViewItemV4::Invalid, backgroundBrush = {d = {
              d = 0x80f9dc0}}}
        viewportWidth = 779
        drawn = {{d = 0x8093080, p = 0x8093080}}
        multipleRects = false
        rects = {{d = 0x8c4ab68, p = 0x8c4ab68}}
        firstVisibleItemOffset = 0
        firstVisibleItem = 0
#5  0xb74e5e3b in QTreeView::paintEvent (this=0x89017b0, event=0xbfffcc44)
    at itemviews/qtreeview.cpp:1274
        d = 0x8b7def0
        painter = {static staticMetaObject = {d = {superdata = 0x0, 
              stringdata = 0xb767f1a0 "QPainter", data = 0xb767f240, extradata = 0x0}}, 
          d_ptr = {d = 0x867a2f0}}
#6  0xb6f808ae in QWidget::event (this=0x89017b0, event=0xbfffcc44)
    at kernel/qwidget.cpp:8346
        d = 0x8b7def0
#7  0xb7370fb3 in QFrame::event (this=0x89017b0, e=0xbfffcc44) at widgets/qframe.cpp:557
        result = <value optimized out>
#8  0xb73ff062 in QAbstractScrollArea::viewportEvent (this=0x89017b0, e=0xbfffcc44)
    at widgets/qabstractscrollarea.cpp:1043
No locals.
#9  0xb749f5c7 in QAbstractItemView::viewportEvent (this=0x89017b0, event=0xbfffcc44)
    at itemviews/qabstractitemview.cpp:1619
        d = <value optimized out>
#10 0xb74e72b3 in QTreeView::viewportEvent (this=0x89017b0, event=0xbfffcc44)
    at itemviews/qtreeview.cpp:1256
        d = <value optimized out>
#11 0xb7401955 in viewportEvent (this=0x8b4b808, o=0x8c46748, e=0xbfffcc44)
    at widgets/qabstractscrollarea_p.h:100
No locals.
#12 QAbstractScrollAreaFilter::eventFilter (this=0x8b4b808, o=0x8c46748, e=0xbfffcc44)
    at widgets/qabstractscrollarea_p.h:116
No locals.
#13 0xb6a4c7aa in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=0x80b89f0, 
    receiver=0x8c46748, event=0xbfffcc44) at kernel/qcoreapplication.cpp:847
        obj = 0x890acc8
        i = <value optimized out>
#14 0xb6f287f0 in QApplicationPrivate::notify_helper (this=0x80b89f0, receiver=0x8c46748, 
    e=0xbfffcc44) at kernel/qapplication.cpp:4441
        consumed = <value optimized out>
#15 0xb6f2d3cb in QApplication::notify (this=0xbffff1d8, receiver=0x8c46748, e=0xbfffcc44)
    at kernel/qapplication.cpp:4410
        d = 0x80b89f0
        res = false
#16 0xb7e00d4a in KApplication::notify (this=0xbffff1d8, receiver=0x8c46748, 
    event=0xbfffcc44) at ../../kdeui/kernel/kapplication.cpp:311
No locals.
#17 0xb6a4c60b in QCoreApplication::notifyInternal (this=0xbffff1d8, receiver=0x8c46748, 
    event=0xbfffcc44) at kernel/qcoreapplication.cpp:732
        threadData = 0x8098eb8
        returnValue = <value optimized out>
        result = false
        cbdata = {0x8c46748, 0xbfffcc44, 0xbfffcbcf}
        d = <value optimized out>
#18 0xb6f7d62c in sendSpontaneousEvent (this=0x8c48e00, pdev=0x8199fec, rgn=..., 
    offset=..., flags=4, sharedPainter=0x0, backingStore=0x8199fb0)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
No locals.
#19 QWidgetPrivate::drawWidget (this=0x8c48e00, pdev=0x8199fec, rgn=..., offset=..., 
    flags=4, sharedPainter=0x0, backingStore=0x8199fb0) at kernel/qwidget.cpp:5433
        paintEngine = 0x827a530
        e = {<QEvent> = {_vptr.QEvent = 0xb7868850, static staticMetaObject = {d = {
                superdata = 0x0, stringdata = 0xb6b1f920 "QEvent", data = 0xb6b20300, 
                extradata = 0x0}}, d = 0x0, t = 12, posted = 0, spont = 1, m_accept = 1, 
            reserved = 276}, m_rect = {x1 = 0, y1 = 0, x2 = 778, y2 = 481}, m_region = {
            d = 0x89af970, static shared_empty = {ref = {_q_value = 345}, rgn = 0x0, 
              xrectangles = 0x0, qt_rgn = 0x0}}, m_erased = false}
        onScreen = false
        asRoot = false
        toBePainted = {d = 0x89af970, static shared_empty = {ref = {_q_value = 345}, 
            rgn = 0x0, xrectangles = 0x0, qt_rgn = 0x0}}
#20 0xb6f7e29c in QWidgetPrivate::paintSiblingsRecursive (this=0x8b7def0, pdev=0x8199fec, 
    siblings=..., index=<value optimized out>, rgn=..., offset=..., flags=4, 
    sharedPainter=0x0, backingStore=0x8199fb0) at kernel/qwidget.cpp:5640
        wRegion = {d = 0x89af970, static shared_empty = {ref = {_q_value = 345}, rgn = 0x0, 
            xrectangles = 0x0, qt_rgn = 0x0}}
        w = <value optimized out>
        boundingRect = {x1 = 3, y1 = 3, x2 = 781, y2 = 484}
        dirtyBoundingRect = false
        exludeOpaqueChildren = false
        wd = 0x8c48e00
        hasMask = false

Reproducible: Always
Comment 1 Pino Toscano 2011-02-05 22:35:37 UTC
*** Bug 265548 has been marked as a duplicate of this bug. ***
Comment 2 Andreas Hartmetz 2011-02-09 20:52:11 UTC
Please check what Valgrind has to say.
Just that a pointer is non-null doesn't mean that it points to memory containing sensible/initialized/not deleted data.
Comment 3 Jonathan Thomas 2011-02-09 21:15:19 UTC
I successfully ran a function of the pointee's right before the extend function was called s, so the widget being extended is indeed initialized right before being extended.
Comment 4 Jonathan Thomas 2011-02-09 21:35:20 UTC
void ApplicationDelegate::itemActivated(QModelIndex index)
{
    if (index == m_oldIndex) {
        return;
    }

    if (isExtended(m_oldIndex)) {
        disconnect(m_extender, SIGNAL(infoButtonClicked(Application *)),
                   this, SIGNAL(infoButtonClicked(Application *)));
        disconnect(m_extender, SIGNAL(installButtonClicked(Application *)),
                   this, SIGNAL(installButtonClicked(Application *)));
        disconnect(m_extender, SIGNAL(removeButtonClicked(Application *)),
                   this, SIGNAL(removeButtonClicked(Application *)));
        disconnect(m_extender, SIGNAL(cancelButtonClicked(Application *)),
                   this, SIGNAL(cancelButtonClicked(Application *)));
        contractItem(m_oldIndex);

        m_extender->deleteLater();
        m_extender = 0;
    }

    Application *app = static_cast<const ApplicationProxyModel*>(index.model())->applicationAt(index);

    QTreeView *view = static_cast<QTreeView*>(parent());
    m_extender = new ApplicationExtender(view, app, m_appBackend);
    connect(m_extender, SIGNAL(infoButtonClicked(Application *)),
            this, SIGNAL(infoButtonClicked(Application *)));
    connect(m_extender, SIGNAL(installButtonClicked(Application *)),
            this, SIGNAL(installButtonClicked(Application *)));
    connect(m_extender, SIGNAL(removeButtonClicked(Application *)),
            this, SIGNAL(removeButtonClicked(Application *)));
    connect(m_extender, SIGNAL(cancelButtonClicked(Application *)),
            this, SIGNAL(cancelButtonClicked(Application *)));

    kDebug() << m_extender->sizeHint().height();
    extendItem(m_extender, index);
    m_oldIndex = index;
}

In a situation where the crash occurs, the kDebug() in the above function gives a correct output of 33. This is also coincidentally the way in which the extender pointer is used internally in kextendableitemdelegate.cpp at line 313.

Since the extender pointer is valid right before KExtendableItemDelegate::extendItem() is called, something inside the KExtendableItemDelegate must mess up the pointer.
Comment 5 Jonathan Thomas 2011-02-09 21:54:18 UTC
A clue; line 313 in kextendableitemdelegate.cpp is nested inside this if statement: if (isExtended(index)) {}

The extender is most definitely not extended at this point, as this crash happens with a totally new view.

Here's the valgrind log for posterity:
==2081== Invalid read of size 4
==2081==    at 0x45568E3: KExtendableItemDelegate::extenderRect(QWidget*, QStyleOptionViewItem const&, QModelIndex const&) const (kextendableitemdelegate.cpp:313)
==2081==    by 0x4557BA1: KExtendableItemDelegate::paint(QPainter*, QStyleOptionViewItem const&, QModelIndex const&) const (kextendableitemdelegate.cpp:277)
==2081==    by 0x806B9ED: ApplicationDelegate::paint(QPainter*, QStyleOptionViewItem const&, QModelIndex const&) const (ApplicationDelegate.cpp:90)
==2081==    by 0x53B1C03: QTreeView::drawRow(QPainter*, QStyleOptionViewItem const&, QModelIndex const&) const (qtreeview.cpp:1678)
==2081==    by 0x53B4A71: QTreeView::drawTree(QPainter*, QRegion const&) const (qtreeview.cpp:1441)
==2081==    by 0x53B53FA: QTreeView::paintEvent(QPaintEvent*) (qtreeview.cpp:1274)
==2081==    by 0x4E5068D: QWidget::event(QEvent*) (qwidget.cpp:8346)
==2081==    by 0x5240FB2: QFrame::event(QEvent*) (qframe.cpp:557)
==2081==    by 0x52CF861: QAbstractScrollArea::viewportEvent(QEvent*) (qabstractscrollarea.cpp:1043)
==2081==    by 0x536E9C6: QAbstractItemView::viewportEvent(QEvent*) (qabstractitemview.cpp:1619)
==2081==    by 0x53B6872: QTreeView::viewportEvent(QEvent*) (qtreeview.cpp:1256)
==2081==    by 0x52D2154: QAbstractScrollAreaFilter::eventFilter(QObject*, QEvent*) (qabstractscrollarea_p.h:100)
==2081==  Address 0x38 is not stack'd, malloc'd or (recently) free'd
==2081==

Looking at the isExtended() function:

bool KExtendableItemDelegate::isExtended(const QModelIndex &index) const
{
    return d->extenders.value(index);
}

d->extenders is a QHash of indices and QWidget *'s. QHash docs state that if that the key passed to value() is not in the QHash, it will return a default-constructed value. If this default-constructed pointer happens to not be pointing at 0x0 (say, 0x38 maybe), then the return statement will return true even though 0x38 is not a valid pointer.

It would be much safer instead to use QHash::contains(key), as it is guaranteed to return false if the key is not present in the QHash. I am running a kdelibs build with this patch to see if this fixes the bug.
Comment 6 Jonathan Thomas 2011-02-09 23:43:54 UTC
Hmm, it still happens when using contains(). The Qt docs also say that a default-constructed value for primitive types such as int and pointers default to 0.

This does however mean that somehow the KExtendableItemDelegate's internals mapped an invalid QWidget pointer to the index instead of the QWidget pointer provided.
Comment 7 Andreas Hartmetz 2011-02-16 03:04:42 UTC
I just had an idea. Check if the index is valid!
Maybe there is an extender (or more) with invalid index in the QHash. I might have to add a check for valid index, probably with a kWarning(), to prevent such errors in the future. Generally check if all indices are sane, like they don't change while KExtendableItemDelegate is using them.
Comment 8 Christoph Feck 2011-04-21 15:05:35 UTC
*** Bug 271201 has been marked as a duplicate of this bug. ***
Comment 9 Ac17 2011-04-21 19:09:49 UTC
My Muon-updater Work perfectly after some update 19/4-11.
Comment 10 Christoph Feck 2011-08-28 19:46:07 UTC
*** Bug 280941 has been marked as a duplicate of this bug. ***
Comment 11 Jonathan Thomas 2011-09-04 20:06:00 UTC
*** Bug 281286 has been marked as a duplicate of this bug. ***
Comment 12 Christoph Feck 2011-09-17 10:25:03 UTC
*** Bug 282176 has been marked as a duplicate of this bug. ***
Comment 13 Vladimir 2011-09-25 07:30:39 UTC
Created attachment 63942 [details]
New crash information added by DrKonqi

muon-installer (1.2.1 "Caustic Carrionite") on KDE Platform 4.7.1 (4.7.1) using Qt 4.7.4

- What I was doing when the application crashed:

I install any of application, then I find the other application and click on him, then muon center's crash.

I can repeat this error.

-- Backtrace (Reduced):
#7  0x00007fa013b73148 in KExtendableItemDelegate::extenderRect (this=0x27f51f0, extender=<optimized out>, option=<optimized out>, index=...) at ../../kdeui/itemviews/kextendableitemdelegate.cpp:313
#8  0x00007fa013b7412d in KExtendableItemDelegate::paint (this=0x27f51f0, painter=0x7fffd798d740, option=..., index=...) at ../../kdeui/itemviews/kextendableitemdelegate.cpp:277
#9  0x000000000042ad37 in ApplicationDelegate::paint (this=0x27f51f0, painter=0x7fffd798d740, option=..., index=...) at /build/buildd/muon-1.2.1/installer/ApplicationModel/ApplicationDelegate.cpp:90
#10 0x00007fa012f0baed in QTreeView::drawRow (this=0x1f75b20, painter=0x7fffd798d740, option=..., index=...) at itemviews/qtreeview.cpp:1678
#11 0x00007fa012f0e5b3 in QTreeView::drawTree (this=0x1f75b20, painter=0x7fffd798d740, region=<optimized out>) at itemviews/qtreeview.cpp:1441
Comment 14 Andreas Hartmetz 2011-09-26 19:22:23 UTC
Git commit fc923ff98a3d0aaf0fb57ca480ba022e2978c2ac by Andreas Hartmetz.
Committed on 26/09/2011 at 21:14.
Pushed by ahartmetz into branch 'KDE/4.7'.

Don't use "method static" (ahem) variables for per-instance data.

When I wrote that code I didn't know that static data in member functions
is "global" - all instances use the same data. So if there is more than
one KExtendableItemDelegate in an application, it makes Bad Things happen.
At least it is binary compatible to remove the bogus variables.

This is officially a brown paper bag bug.

Hopefully fixes
BUG: 259333

M  +26   -21   kdeui/itemviews/kextendableitemdelegate.cpp

http://commits.kde.org/kdelibs/fc923ff98a3d0aaf0fb57ca480ba022e2978c2ac
Comment 15 Andreas Hartmetz 2014-07-06 15:19:38 UTC
Seems fixed now with the commit from the last comment, please reopen if necessary.