Hi,

I'm not sure that this will help, but...

Can you reset model on closing of your table view, drop any data, etc... And then close view.

If I understood your correctly you are loading model again on new show?

On 18.01.2016 11:40, Mojmír Svoboda wrote:
Hello,

i have a crash in QCommonStyle::subElementRect

    case SE_ItemViewItemDecoration:
    case SE_ItemViewItemText:
    case SE_ItemViewItemFocusRect:
        if (const QStyleOptionViewItem *vopt = ...) {
            if (!d->isViewItemCached(*vopt)) {
                d->viewItemLayout(...);
                if (d->cachedOption) {
>>>>                delete d->cachedOption;
                    d->cachedOption = 0;
                }
                d->cachedOption = new QStyleOptionViewItem(*vopt);
            }

with callstack:
  QArrayData::deallocate
  QTypedArrayData<unsigned short>::deallocate(QArrayData * data)
  QString::~QString() Line 1070
  QStyleOptionViewItem::~QStyleOptionViewItem()
  QStyleOptionViewItem::`scalar deleting destructor'(unsigned int)
> QCommonStyle::subElementRect(QStyle::SubElement sr, const QStyleOption * opt, const QWidget * widget) Line 2993
  QWindowsStyle::subElementRect
  QWindowsVistaStyle::subElementRect
  QCommonStyle::drawControl
  QWindowsStyle::drawControl
  QWindowsVistaStyle::drawControl
  QStyledItemDelegate::paint
  QTableViewPrivate::drawCell
  QTableView::paintEvent
  ...


How this occurs:
i have QTableView with custom model that uses memmapped file filled with lots of QStringData. These QStringData are set using the technique presented in http://woboq.com/blog/qstringliteral.html for example.

The problem is when the storage goes away (widget is closed), because there may be copies of those strings, and indeed they are.

One of the copies is in QCommonStylePrivate::cachedOption::text field. I
suspect these style classes use some form of sharing, so when i close the widget, the copy of qstring will survive the storage, and then when new qtableview opens, it tries to reuse the style and on the first use it destroys the old content of .text field and crash follows.

Now what do i do? Try to force somehow the style class to drop the d->cachedOption?
Any ideas, please?

Best regards,
Mojmir
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to