Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-43638

QQuickStyle virtually deletes QStyleOption objects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.5.0
    • Quick: Controls 1
    • None

    Description

      In qquickstyleitem.cpp there's code like this (see the switch in QQuickStyleItem::initStyleOption):

      m_styleoption = new QStyleOptionButton();
      

      where m_styleoption is a pointer to QStyleOption.

      Since QStyleOption does not have a virtual destructor (OOPS?), the non-virtual deletion that then happens in QQuickStyleItem's dtor leaks memory and invokes undefined behaviour:

      QQuickStyleItem::~QQuickStyleItem()
      {
      delete m_styleoption; // kaboom
      m_styleoption = 0;
      }
      

      Attachments

        For Gerrit Dashboard: QTBUG-43638
        # Subject Branch Project Status CR V

        Activity

          People

            shausman Simon Hausmann
            peppe Giuseppe D'Angelo
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes