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. app crash while scaling QImage
Forum Updated to NodeBB v4.3 + New Features

app crash while scaling QImage

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 646 Views 1 Watching
  • 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.
  • K Offline
    K Offline
    know
    wrote on 14 Apr 2023, 10:36 last edited by
    #1

    My app crashes. While QImage newImg = img.scaled(qSize, Qt::KeepAspectRatio, Qt::SmoothTransformation) I get:

    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffff6957c28, pid=6200, tid=0x0000000000000058
    #
    # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10)
    # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops)
    # Problematic frame:
    # C  [Qt5Guid.dll+0x77c28]
    #
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid6200.log
    Compiled method (c1)   34920 4229       3       jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes)
     total in heap  [0x000002542973a2d0,0x000002542973d450] = 12672
     relocation     [0x000002542973a3f0,0x000002542973a620] = 560
     main code      [0x000002542973a620,0x000002542973c0c0] = 6816
     stub code      [0x000002542973c0c0,0x000002542973c250] = 400
     oops           [0x000002542973c250,0x000002542973c278] = 40
     metadata       [0x000002542973c278,0x000002542973c308] = 144
     scopes data    [0x000002542973c308,0x000002542973cfb0] = 3240
     scopes pcs     [0x000002542973cfb0,0x000002542973d3d0] = 1056
     dependencies   [0x000002542973d3d0,0x000002542973d3f8] = 40
     nul chk table  [0x000002542973d3f8,0x000002542973d450] = 88
    

    while QImage newImg = img.copy(0, 0, 100, 100) I get:

    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe0ed61657, pid=20448, tid=0x0000000000002d60
    #
    # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10)
    # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops)
    # Problematic frame:
    # C  [VCRUNTIME140D.dll+0x1657]
    #
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid20448.log
    Compiled method (c1)   28336 4193       3       jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes)
     total in heap  [0x0000023cbc5138d0,0x0000023cbc516a50] = 12672
     relocation     [0x0000023cbc5139f0,0x0000023cbc513c20] = 560
     main code      [0x0000023cbc513c20,0x0000023cbc5156c0] = 6816
     stub code      [0x0000023cbc5156c0,0x0000023cbc515850] = 400
     oops           [0x0000023cbc515850,0x0000023cbc515878] = 40
     metadata       [0x0000023cbc515878,0x0000023cbc515908] = 144
     scopes data    [0x0000023cbc515908,0x0000023cbc5165b0] = 3240
     scopes pcs     [0x0000023cbc5165b0,0x0000023cbc5169d0] = 1056
     dependencies   [0x0000023cbc5169d0,0x0000023cbc5169f8] = 40
     nul chk table  [0x0000023cbc5169f8,0x0000023cbc516a50] = 88
    

    More info here.

    Any idea, what could be wrong, please?
    I do use Qt 5.12.0, system info:

    ---------------  S Y S T E M  ---------------
    
    OS: Windows 10.0 , 64 bit Build 19041 (10.0.19041.2546)
    
    CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 94 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx
    
    Memory: 4k page, physical 16694920k(10934708k free), swap 23510664k(11805564k free)
    
    vm_info: OpenJDK 64-Bit Server VM (25.222-b10) for windows-amd64 JRE (1.8.0_222-1-ojdkbuild-b10), built on Jul 18 2019 16:58:32 by "VssAdministrator" with MS VC++ 10.0 (VS2010)
    
    S 1 Reply Last reply 14 Apr 2023, 19:54
    0
    • K know
      14 Apr 2023, 10:36

      My app crashes. While QImage newImg = img.scaled(qSize, Qt::KeepAspectRatio, Qt::SmoothTransformation) I get:

      # A fatal error has been detected by the Java Runtime Environment:
      #
      #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffff6957c28, pid=6200, tid=0x0000000000000058
      #
      # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10)
      # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops)
      # Problematic frame:
      # C  [Qt5Guid.dll+0x77c28]
      #
      # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
      #
      # An error report file with more information is saved as:
      # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid6200.log
      Compiled method (c1)   34920 4229       3       jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes)
       total in heap  [0x000002542973a2d0,0x000002542973d450] = 12672
       relocation     [0x000002542973a3f0,0x000002542973a620] = 560
       main code      [0x000002542973a620,0x000002542973c0c0] = 6816
       stub code      [0x000002542973c0c0,0x000002542973c250] = 400
       oops           [0x000002542973c250,0x000002542973c278] = 40
       metadata       [0x000002542973c278,0x000002542973c308] = 144
       scopes data    [0x000002542973c308,0x000002542973cfb0] = 3240
       scopes pcs     [0x000002542973cfb0,0x000002542973d3d0] = 1056
       dependencies   [0x000002542973d3d0,0x000002542973d3f8] = 40
       nul chk table  [0x000002542973d3f8,0x000002542973d450] = 88
      

      while QImage newImg = img.copy(0, 0, 100, 100) I get:

      # A fatal error has been detected by the Java Runtime Environment:
      #
      #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe0ed61657, pid=20448, tid=0x0000000000002d60
      #
      # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10)
      # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops)
      # Problematic frame:
      # C  [VCRUNTIME140D.dll+0x1657]
      #
      # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
      #
      # An error report file with more information is saved as:
      # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid20448.log
      Compiled method (c1)   28336 4193       3       jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes)
       total in heap  [0x0000023cbc5138d0,0x0000023cbc516a50] = 12672
       relocation     [0x0000023cbc5139f0,0x0000023cbc513c20] = 560
       main code      [0x0000023cbc513c20,0x0000023cbc5156c0] = 6816
       stub code      [0x0000023cbc5156c0,0x0000023cbc515850] = 400
       oops           [0x0000023cbc515850,0x0000023cbc515878] = 40
       metadata       [0x0000023cbc515878,0x0000023cbc515908] = 144
       scopes data    [0x0000023cbc515908,0x0000023cbc5165b0] = 3240
       scopes pcs     [0x0000023cbc5165b0,0x0000023cbc5169d0] = 1056
       dependencies   [0x0000023cbc5169d0,0x0000023cbc5169f8] = 40
       nul chk table  [0x0000023cbc5169f8,0x0000023cbc516a50] = 88
      

      More info here.

      Any idea, what could be wrong, please?
      I do use Qt 5.12.0, system info:

      ---------------  S Y S T E M  ---------------
      
      OS: Windows 10.0 , 64 bit Build 19041 (10.0.19041.2546)
      
      CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 94 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx
      
      Memory: 4k page, physical 16694920k(10934708k free), swap 23510664k(11805564k free)
      
      vm_info: OpenJDK 64-Bit Server VM (25.222-b10) for windows-amd64 JRE (1.8.0_222-1-ojdkbuild-b10), built on Jul 18 2019 16:58:32 by "VssAdministrator" with MS VC++ 10.0 (VS2010)
      
      S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Apr 2023, 19:54 last edited by
      #2

      Hi and welcome to devnet,

      Are you using a 32bit build of Qt ?
      Are you tied to 5.12.0 ? Can you at least test with a more recent version ?

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

      K 1 Reply Last reply 15 Apr 2023, 17:36
      0
      • S SGaist
        14 Apr 2023, 19:54

        Hi and welcome to devnet,

        Are you using a 32bit build of Qt ?
        Are you tied to 5.12.0 ? Can you at least test with a more recent version ?

        K Offline
        K Offline
        know
        wrote on 15 Apr 2023, 17:36 last edited by
        #3

        @SGaist Thanks for comment! I do use 64bit version. I tried 5.12.0 and 5.12.12. I can check if there is some newer version to use, because I use VS2015 to build and debug my app. There might be problem with memory, tiff file allocates 4.2GB. Windows photos or paint can not display it as well. Gimp can do it, it needs over 6GB of RAM. I never tried to open such big tiff before this one.

        S 1 Reply Last reply 15 Apr 2023, 18:57
        0
        • K know
          15 Apr 2023, 17:36

          @SGaist Thanks for comment! I do use 64bit version. I tried 5.12.0 and 5.12.12. I can check if there is some newer version to use, because I use VS2015 to build and debug my app. There might be problem with memory, tiff file allocates 4.2GB. Windows photos or paint can not display it as well. Gimp can do it, it needs over 6GB of RAM. I never tried to open such big tiff before this one.

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 15 Apr 2023, 18:57 last edited by
          #4

          What kind of Tiff file is that ?
          Do you really need to load it fully in memory ?

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

          K 1 Reply Last reply 15 Apr 2023, 19:25
          0
          • S SGaist
            15 Apr 2023, 18:57

            What kind of Tiff file is that ?
            Do you really need to load it fully in memory ?

            K Offline
            K Offline
            know
            wrote on 15 Apr 2023, 19:25 last edited by know
            #5

            @SGaist it is a technical drawing. It is saved as RGBA8888, therefore needs so much memory. I need as good quality of image as it get. Maybe I could create QImage::Format_Mono, but would be great to display any tiff anyway. But strange is that app crashes even when trying to display small piece: QImage newImg = img.copy(0, 0, 100, 100).
            Some real data:

            i_Width:81118
            i_Height:13244
            l_originRowBytes:324472
            l_rowBytes:324472
            l_originSize:2339872
            
            QImage::Format_RGBA8888 
            qSize:4297307168 // after memory allocation
            
            S 1 Reply Last reply 16 Apr 2023, 19:09
            0
            • K know
              15 Apr 2023, 19:25

              @SGaist it is a technical drawing. It is saved as RGBA8888, therefore needs so much memory. I need as good quality of image as it get. Maybe I could create QImage::Format_Mono, but would be great to display any tiff anyway. But strange is that app crashes even when trying to display small piece: QImage newImg = img.copy(0, 0, 100, 100).
              Some real data:

              i_Width:81118
              i_Height:13244
              l_originRowBytes:324472
              l_rowBytes:324472
              l_originSize:2339872
              
              QImage::Format_RGBA8888 
              qSize:4297307168 // after memory allocation
              
              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 16 Apr 2023, 19:09 last edited by
              #6

              If only Gimp is able to load that file it likely uses something smart to load such a file. I currently don't think the Tiff image loader from Qt is that subtle.

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

              K 1 Reply Last reply 18 Apr 2023, 11:11
              0
              • S SGaist
                16 Apr 2023, 19:09

                If only Gimp is able to load that file it likely uses something smart to load such a file. I currently don't think the Tiff image loader from Qt is that subtle.

                K Offline
                K Offline
                know
                wrote on 18 Apr 2023, 11:11 last edited by
                #7

                @SGaist maybe I've found the problem: I use

                void myImageObj::addData(unsigned char *i_pData, unsigned int i_bytesPerRow, unsigned int i_width, unsigned int i_height, float i_scaleX, float i_scaleY, unsigned short int i_spp, unsigned short int i_bps, int i_layertype, int i_PosX, int i_PosY)
                {
                  if(i_layertype == BACKGROUND)
                    m_data = QVector<unsigned char>(i_bytesPerRow*i_height);
                  else
                    m_data = QVector<unsigned char>(i_bytesPerRow);
                  m_bytesPerRow = i_bytesPerRow;
                  m_width = i_width;
                  m_height = i_height;
                  m_scaleX = i_scaleX;
                  m_scaleY = i_scaleY;
                  m_spp = i_spp;
                  m_bps = i_bps;
                  m_layertype = (LAYERTYPE)i_layertype;
                  m_PosX = i_PosX;
                  m_PosY = i_PosY;
                  int mds = m_data.size();
                  std::copy(i_pData, i_pData + m_data.size(),
                            stdext::checked_array_iterator<unsigned char*>(
                              m_data.data(), m_data.size()));
                }
                

                and then m_data.size() = 2,339,872 although I allocated 4,297,307,168. I miss exactly 2^32. I probably need something else then QVector.

                S 1 Reply Last reply 18 Apr 2023, 19:58
                0
                • K know
                  18 Apr 2023, 11:11

                  @SGaist maybe I've found the problem: I use

                  void myImageObj::addData(unsigned char *i_pData, unsigned int i_bytesPerRow, unsigned int i_width, unsigned int i_height, float i_scaleX, float i_scaleY, unsigned short int i_spp, unsigned short int i_bps, int i_layertype, int i_PosX, int i_PosY)
                  {
                    if(i_layertype == BACKGROUND)
                      m_data = QVector<unsigned char>(i_bytesPerRow*i_height);
                    else
                      m_data = QVector<unsigned char>(i_bytesPerRow);
                    m_bytesPerRow = i_bytesPerRow;
                    m_width = i_width;
                    m_height = i_height;
                    m_scaleX = i_scaleX;
                    m_scaleY = i_scaleY;
                    m_spp = i_spp;
                    m_bps = i_bps;
                    m_layertype = (LAYERTYPE)i_layertype;
                    m_PosX = i_PosX;
                    m_PosY = i_PosY;
                    int mds = m_data.size();
                    std::copy(i_pData, i_pData + m_data.size(),
                              stdext::checked_array_iterator<unsigned char*>(
                                m_data.data(), m_data.size()));
                  }
                  

                  and then m_data.size() = 2,339,872 although I allocated 4,297,307,168. I miss exactly 2^32. I probably need something else then QVector.

                  S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 18 Apr 2023, 19:58 last edited by
                  #8

                  Qt 5's QVector uses an int for its size so you have hit its limit.

                  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
                  1

                  1/8

                  14 Apr 2023, 10:36

                  • Login

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