Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPixmapCache insert behaviour when insert fails
QtWS25 Last Chance

QPixmapCache insert behaviour when insert fails

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5.8pixmapcache
4 Posts 3 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wambach
    wrote on last edited by Wambach
    #1

    Hej there, I'm new here and hope to be welcome, anyway.
    I did a (short) search for existence of my topic, but did not find some.
    For my question I provide some background information first:

    We do develop some project using QT5.8, on Windows 10 with VS2015.
    I do load a resource PNG file (3000x1781px ARGB) and QT tries to save it
    in PixmapCache, more exactly in QPMCache module. The method insert is
    called, but returns false as the size (21.7M is bigger than some
    ‘mx’), and the code from qt-everywhere-opensource-src-5.8.0/qtbase/src/gui/image/qpixmapcache.cpp
    tells to remove the key that was inserted anyway, and then to release it, as follows.

    bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
    {
        [ … ]
        } else {
             //Insertion failed we released the new allocated key
    (--!-->) cacheKeys.remove(key); (<--!--)
             releaseKey(cacheKey);
        }
    }
    

    In my case, the marked line is called, in there the given key is found and the holding node gets removed from cacheKeys and freed,. So, my cacheKey is freed also, what makes the call of next method releaseKey throw.

    I did comment out the line marked above, recompiled that module, now it works.
    Is this a problem on my side or a bug?

    Hope you are able to understand my humble english...

    Regards and thanks for help,

    F. Wambach

    VRoninV 1 Reply Last reply
    0
    • W Wambach

      Hej there, I'm new here and hope to be welcome, anyway.
      I did a (short) search for existence of my topic, but did not find some.
      For my question I provide some background information first:

      We do develop some project using QT5.8, on Windows 10 with VS2015.
      I do load a resource PNG file (3000x1781px ARGB) and QT tries to save it
      in PixmapCache, more exactly in QPMCache module. The method insert is
      called, but returns false as the size (21.7M is bigger than some
      ‘mx’), and the code from qt-everywhere-opensource-src-5.8.0/qtbase/src/gui/image/qpixmapcache.cpp
      tells to remove the key that was inserted anyway, and then to release it, as follows.

      bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
      {
          [ … ]
          } else {
               //Insertion failed we released the new allocated key
      (--!-->) cacheKeys.remove(key); (<--!--)
               releaseKey(cacheKey);
          }
      }
      

      In my case, the marked line is called, in there the given key is found and the holding node gets removed from cacheKeys and freed,. So, my cacheKey is freed also, what makes the call of next method releaseKey throw.

      I did comment out the line marked above, recompiled that module, now it works.
      Is this a problem on my side or a bug?

      Hope you are able to understand my humble english...

      Regards and thanks for help,

      F. Wambach

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      @Wambach said in QPixmapCache insert behaviour when insert fails:

      I do load a resource PNG file (3000x1781px ARGB) and QT tries to save it in PixmapCache, more exactly in QPMCache module. The method insert is called, but returns false as the size (21.7M is bigger than some ‘mx’)

      If I understood correctly your problem comes from rcc, can it be this? https://forum.qt.io/topic/71838/large-number-of-png-resources-qrc_resources-cpp-segmentation-fault-11/3

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      W 1 Reply Last reply
      1
      • VRoninV VRonin

        @Wambach said in QPixmapCache insert behaviour when insert fails:

        I do load a resource PNG file (3000x1781px ARGB) and QT tries to save it in PixmapCache, more exactly in QPMCache module. The method insert is called, but returns false as the size (21.7M is bigger than some ‘mx’)

        If I understood correctly your problem comes from rcc, can it be this? https://forum.qt.io/topic/71838/large-number-of-png-resources-qrc_resources-cpp-segmentation-fault-11/3

        W Offline
        W Offline
        Wambach
        wrote on last edited by
        #3

        @VRonin

        If I understood correctly your problem comes from rcc, can it be this? https://forum.qt.io/topic/71838/large-number-of-png-resources-qrc_resources-cpp-segmentation-fault-11/3

        yes, that's true, it an image loaded from qrc.
        Anyway, as size does not matter yet, we did include the resources file (the png file is about 270kB, though, and expands to RGBA-fullsize bitmap of some 20MB only internally for QPixmapCache).
        Beside that, I did ancounter given problem, and could overcome that only by disabling the code line.
        So, still the question is: Is that a bug?

        Regards,

        Wambach

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Looks similar to QTBUG-59065 which is a duplicate of QTBUG-58259.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved