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

Crash and memory leak in QQuickAnimatedImage

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.9.0
    • None

    Description

      QQuickAnimatedImage loading twice when the image is displays in window placed on second monitor and when that image loads with asynchronous network request.
      That causes a memory leak and a possible crash.

      QQuickAnimatedImage::load() normaly calls from QQuickAnimatedImage::componentComplete(), but a second call occuried immediately after the screenChanged signal was emmited and handled with QQuickImageBase::handleScreenChanged.
      When processing QQuickAnimatedImage::load() with first call, the "d->reply" object is initialized here:

      d->reply = qmlEngine(this)->networkAccessManager()->get(req);

      but when processing with a second call, "d->reply" object is initialized again, but previous one was not destroyed!
      After that "finished" signal is also handled twice with QQuickAnimatedImage::movieRequestFinished(). First call of it will initialize "d->_movie"  object here:

       

      d->_movie = new QMovie(d->reply);

       

      and the second call will do the same with generating next memory leak. Moreover, if "d->_movie" will be not valid with second call, than the crash will be occuried in QQuickAnimatedImage::playingStatusChanged(), that was connected to "stateChanged" signal on first call. Because QQuickAnimatedImage::playingStatusChanged() has no check for "d->_movie" for nullptr.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              golomysov Mikhail Golomysov
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes