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

grab() function of QQuickView would crash on android

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 5.2.0
    • QPA
    • None
    • mac OS X 10.8.5
      Qt5.2

      tried api 10,14,15,19
      compile with armeabi
    • Android

    Description

      error message

      F/libc    (30728): Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 30752 (ple.androidTest)
      
      .hpp
      @
      #ifndef SCREENCAPTURE_HPP
      #define SCREENCAPTURE_HPP
      
      #include <QObject>
      
      class QQuickView;
      
      class screenCapture : public QObject
      {
          Q_OBJECT
      public:    
          explicit screenCapture(QQuickView *parent = 0);
          screenCapture& operator=(screenCapture const&) = delete;
          screenCapture(screenCapture const&) = delete;
          
          Q_INVOKABLE void capture();
      
      private:
          //QtQuick2ApplicationViewer *currentView_;
          QQuickView *currentView_;
      
          QString previous_name_;
          
      };
      
      #endif // SCREENCAPTURE_HPP
      @
      
      .cpp
      @
      #include <QQuickView>
      
      #include "screenCapture.hpp"
      
      screenCapture::screenCapture(QQuickView *parent) :
          QObject(nullptr), currentView_(parent)
      {
      }
      
      /**
       * @brief capture screen
       */
      void screenCapture::capture()
      {
          currentView_->grabWindow();
      }
      @
      
      main.cpp
      @
      #include <QtGui/QGuiApplication>
      #include "qtquick2applicationviewer.h"
      
      #include <QQuickPaintedItem>
      
      #include "screenCapture.hpp"
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          qmlRegisterType<screenCapture>("ScreenCapture", 1, 0, "ScreenCap");
      
          QtQuick2ApplicationViewer viewer;
          viewer.setMainQmlFile(QStringLiteral("qml/androidTest/main.qml"));
          viewer.showExpanded();
      
          return app.exec();
      }
      
      @
      
      main.qml
      @
      import QtQuick 2.0
      
      import ScreenCapture 1.0
      
      Rectangle {
          width: 360
          height: 360
      
          ScreenCap{id: cap}
      
          MouseArea {
              id: mouseArea
      
              anchors.fill: parent
      
              onClicked: {
                  cap.capture()
              }
          }    
      }
      

      @

      I upload the full example(androidTest.zip)

      Attachments

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              stereomatching stereoMatching
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes