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

Crash when QGraphicsOpacityEffect has 1.0 opacity and child widget has graphics effect

    XMLWordPrintable

Details

    • 7257862fb2edfab0219d6cd45c83677049404f7d

    Description

      When a widget has QGraphicsOpacityEffect set to 1.0 and it contains child widgets with other graphic effects, the application first warns about invalid use of QPainter:

      QPainter::begin: A paint device can only be painted by one painter at a time.
      QPainter::translate: Painter not active
      QPainter::worldTransform: Painter not active

      and soon after the invalid painter is used, which leads to crash in QWidgetEffectSourcePrivate::pixmap().

      The problem occurs only when the opacity is ~1.0 i.e. QGraphicsOpacityEffectPrivate::isFullyOpaque is true in /qtbase/src/widgets/effects/qgraphicseffect.cpp. Then in QGraphicsOpacityEffect::draw() the widget is drawn directly without going through a pixmap (see /qtbase/src/widgets/effects/qgraphicseffect.cpp, line 1198). In that case the same paint device (QImage) is used, but the painter is not shared and therefore a new painter is created for the same active paint device.

      The attached example reproduces the problem. Running it leads to an immediate crash, but the crash can be prevented by changing the opacity to for example 0.99.

      Attachments

        1. qtbug60231_diag.diff
          5 kB
        2. qtbug60231_log.txt
          2 kB
        3. qtbug60231_no_child_effect_log.txt
          1 kB
        4. qtbug60231_stack_48.txt
          28 kB
        5. qtbug60231_stack_58.txt
          17 kB
        6. qtbug60231.zip
          1 kB
        7. qtbug60231.zip
          2 kB

        Issue Links

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

          Activity

            People

              allan.jensen Allan Sandfeld Jensen
              qtcomsupport Qt Support
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: