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

Qt Android creates View IDs in a way potentially leading to a collision

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.2
    • Core: Plugins
    • None
    • Android

      Qt Android uses consecutive numbers starting from 1 as ids for View.setId(int) (variable m_surfaceId in src/plugins/platforms/android/androidjnimain.cpp). Additionally, the ids are used internally with an assumption that they are unique. It leads to unexpected behavior in some specific scenarios.

      Exemplary situation leading to an undef behavior can be reproduced as follows:

      1. add native view using insertNativeView(id, ...) using id obtained via View.generateViewId()
      2. change coordinates of the added view using setSurfaceGeometry(id, ...)

      As a result, geometry is changed for surface rendering Qt application not for just added native view because of the colliding ids.

       

      My proposition is to use View.generateViewId() in androidjnimain.cpp for obtaining id, instead of relying on a private counter.

        1. view_id_fix.patch
          1 kB
          Michał Cieślak
        For Gerrit Dashboard: QTBUG-98649
        # Subject Branch Project Status CR V

            mcieslak Michał Cieślak
            mcieslak Michał Cieślak
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes