Uploaded image for project: 'Qt Solutions'
  1. Qt Solutions
  2. QTSOLBUG-122

Using a QtColorComboBox as an editor in a view leads to a crash when I select and apply a color in the color dialog that is displayed when you click on the "more ..." button (enabled with QtColorComboBox::setColorDialogEnabled(true) )

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • No Version
    • Color ComboBox
    • None

    Description

      I am using a model view to display colors as one of the properties of certain items in a tree-/tableview. I wanted to make it possible for the user to modify this property using a QtColorComboBox as an editor. This works, however if I enable custom color with setColorDialogEnabled() the application crashes instantly after I press Ok, or Cancel, (or press Esc) from within the color dialog (which is displayed when I click on the "more ..." entry in the combo box).

      Versions where I could confirm this issue:

      • Qt-4.5.3
      • Qt-4.6.1
      • Qt-4.6.2
      • Qt-4.7

      Steps to reproduce:

      • compile and execute the attached test application which highlights the issue
      • select a cell from the view and click on the "more ..." button to get a color selection dialog
      • select a color if you like and click on either the "Ok" or "Cancel" Button.
        The program should have crashed by now.

      the debugger backtrace tells me the crash takes place in QComboBox::count():
      0 QComboBox::count qcombobox.cpp 1299 0xb79240c7
      1 QtColorComboBox::colorCount qtcolorcombobox.cpp 174 0x0804dc6f
      2 QtColorComboBox::addColor qtcolorcombobox.h 75 0x0804f2c3
      3 QtColorComboBox::emitActivatedColor qtcolorcombobox.cpp 235 0x0804ec00
      4 QtColorComboBox::qt_metacall moc_qtcolorcombobox.cpp 82 0x0804f447
      5 QMetaObject::metacall qmetaobject.cpp 237 0xb723e158
      6 QMetaObject::activate qobject.cpp 3285 0xb724e5da
      7 QComboBox::activated moc_qcombobox.cpp 274 0xb7923b45
      8 QComboBoxPrivate::emitActivated qcombobox.cpp 1218 0xb7925e42
      9 QComboBoxPrivate::_q_itemSelected qcombobox.cpp 1209 0xb7928e3f
      10 QComboBox::qt_metacall moc_qcombobox.cpp 191 0xb792edd7
      11 QtColorComboBox::qt_metacall moc_qtcolorcombobox.cpp 75 0x0804f3b6
      12 QMetaObject::metacall qmetaobject.cpp 237 0xb723e158
      13 QMetaObject::activate qobject.cpp 3285 0xb724e5da
      14 QComboBoxPrivateContainer::itemSelected moc_qcombobox_p.cpp 213 0xb7c88345
      15 QComboBoxPrivateContainer::eventFilter qcombobox.cpp 663 0xb792593c
      16 QCoreApplicationPrivate::sendThroughObjectEventFilters qcoreapplication.cpp 819 0xb723670e
      17 QApplicationPrivate::notify_helper qapplication.cpp 4296 0xb749663f
      18 QApplication::notify qapplication.cpp 3865 0xb749e44e
      19 QCoreApplication::notifyInternal qcoreapplication.cpp 704 0xb7236f1e
      20 QCoreApplication::sendEvent qcoreapplication.h 215 0xb749d1cc
      ...

      Valgrind tells me the crash is due to a memory bug (the valgrind log file in included in the zip file and is called valgrind.log):
      Invalid read of size 4
      at 0x8058F6E: QtColorComboBox::emitActivatedColor(int) (qtcolorcombobox.cpp:233)
      by 0x8059E6E: QtColorComboBox::qt_metacall(QMetaObject::Call, int, void**) (moc_qtcolorcombobox.cpp:82)
      by 0x4D1F157: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237)
      by 0xBEE20D63: ???
      Address 0x562f9e4 is 36 bytes inside a block of size 48 free'd
      at 0x402594C: realloc (vg_replace_malloc.c:476)
      by 0x4BF4632: qRealloc(void*, unsigned int) (qmalloc.cpp:65)

      Invalid write of size 4
      at 0x8058F77: QtColorComboBox::emitActivatedColor(int) (qtcolorcombobox.cpp:233)
      by 0x8059E6E: QtColorComboBox::qt_metacall(QMetaObject::Call, int, void**) (moc_qtcolorcombobox.cpp:82)
      by 0x4D1F157: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237)
      by 0xBEE20D63: ???
      Address 0x562f9e4 is 36 bytes inside a block of size 48 free'd
      at 0x402594C: realloc (vg_replace_malloc.c:476)
      by 0x4BF4632: qRealloc(void*, unsigned int) (qmalloc.cpp:65)

      Invalid read of size 4
      at 0x8058F7D: QtColorComboBox::emitActivatedColor(int) (qtcolorcombobox.cpp:233)
      by 0x8059E6E: QtColorComboBox::qt_metacall(QMetaObject::Call, int, void**) (moc_qtcolorcombobox.cpp:82)
      by 0x4D1F157: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237)
      by 0xBEE20D63: ???
      Address 0x562f9e4 is 36 bytes inside a block of size 48 free'd
      at 0x402594C: realloc (vg_replace_malloc.c:476)
      by 0x4BF4632: qRealloc(void*, unsigned int) (qmalloc.cpp:65)

      Invalid read of size 4
      at 0x45F10B3: QComboBox::count() const (qcombobox.h:302)
      by 0x8059636: QtColorComboBox::addColor(QColor const&, QString const&) (qtcolorcombobox.h:75)
      by 0x8058FE6: QtColorComboBox::emitActivatedColor(int) (qtcolorcombobox.cpp:233)
      by 0x8059E6E: QtColorComboBox::qt_metacall(QMetaObject::Call, int, void**) (moc_qtcolorcombobox.cpp:82)
      by 0x4D1F157: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237)
      by 0xBEE20D63: ???
      Address 0x562f9c4 is 4 bytes inside a block of size 48 free'd
      at 0x402594C: realloc (vg_replace_malloc.c:476)
      by 0x4BF4632: qRealloc(void*, unsigned int) (qmalloc.cpp:65)

      Invalid read of size 4
      at 0x45F10C1: QComboBox::count() const (qcombobox.cpp:1299)
      by 0x8059636: QtColorComboBox::addColor(QColor const&, QString const&) (qtcolorcombobox.h:75)
      by 0x8058FE6: QtColorComboBox::emitActivatedColor(int) (qtcolorcombobox.cpp:233)
      by 0x8059E6E: QtColorComboBox::qt_metacall(QMetaObject::Call, int, void**) (moc_qtcolorcombobox.cpp:82)
      by 0x4D1F157: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237)
      by 0xBEE20D63: ???
      Address 0x12a is not stack'd, malloc'd or (recently) free'd

      Process terminating with default action of signal 11 (SIGSEGV)
      Access not within mapped region at address 0x12A
      at 0x45F10C1: QComboBox::count() const (qcombobox.cpp:1299)
      by 0x8059636: QtColorComboBox::addColor(QColor const&, QString const&) (qtcolorcombobox.h:75)
      by 0x8058FE6: QtColorComboBox::emitActivatedColor(int) (qtcolorcombobox.cpp:233)
      by 0x8059E6E: QtColorComboBox::qt_metacall(QMetaObject::Call, int, void**) (moc_qtcolorcombobox.cpp:82)
      by 0x4D1F157: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237)
      by 0xBEE20D63: ???

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            momesana M. Mehdi Salem N.
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes