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

Screenshot of second screen on osx 10.7 still does not work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 4.8.4
    • GUI: Workspace
    • None
    • macOS

    Description

      This bug was already declared as bug n. 19824 (https://bugreports.qt-project.org/browse/QTBUG-19824) but it seems like it is not yet solved... at least on my hardware/software combination.

      I am testing with qt 4.8.4 on a mac:

      1. sw_vers
        ProductName: Mac OS X
        ProductVersion: 10.7.5
        BuildVersion: 11G63b
      1. uname -a
        Darwin iscpc75.epfl.ch 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64

      Please find attached a slightly modified version of the screenshot demo code.
      In the archive package you can also find 4 screenshots demonstrating the problem.
      The first screen is grabbed correctly. The problem arises when a second screen is attached and I want to grab that one.

      screenshot0.png : taken using standard QPixmap::grabWindow shows that the image is completely black;

      screenshot1.png : I try to take the snapshot of both screens at the same time with QPixmap::grabWindow(0,0,width_screen0+width_screen1, width_screen0). Is shows an image were screen1 appears twice (once on top of screen0 and once as aspected on the right of screen0);

      screenshot2.png : I can grab the second screen by just cropping the image captured with the hack explained for screenshot1.

      screenshot3.png : Screen1 captured using native apple api (see code). This one works fine and without memory leaks.

      The hack is clearly a bad solution as it leads to horrible memory leaks (the application grows at the rate of ~ 40Mb/image). The fact that the image of screen1 is shown twice is also a sign of something bad going on with memory.

      You can do the tests by yourself using the attached code.

      Note that in the apple version, it is very important to release the grabbed image by calling CGImageRelease(image) (line 144 of my screenshot.cpp file).

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            giovanni.cangiani Giovanni Cangiani
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes