← Back to team overview

touch-packages team mailing list archive

[Bug 1504189] Re: ActionSelectionPopover's CPO click_action_button fails if we destroy the popover as result of an action

 

Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: ubuntu-ui-toolkit (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-ui-toolkit in
Ubuntu.
https://bugs.launchpad.net/bugs/1504189

Title:
  ActionSelectionPopover's CPO click_action_button fails if we destroy
  the popover as result of an action

Status in ubuntu-ui-toolkit package in Ubuntu:
  Confirmed

Bug description:
  When using the click_action_button of the Custom Proxy Object for
  ActionSelectionPopover in an autopilot test, we get an exception in
  case the action that gets clicked has the result of destroying the
  popover.

  The bug is caused by the fact that, once the action item has been clicked, the CPO method tries to access the autoClose property of the popover. However at this point the popover might have been already destroyed, causing an exception.
  A simple fix is to cache the value just before the click and refer to the value after, as autoClose is unlikely to change as a result of the click.

  For a real life example of this problem, imagine a ListView we pop up
  a menu with an action that allows the user to delete the delegate
  pointed at by the popup. This is very common case. The example below
  is the simplest version of a test case that implements this. You can
  easily create an AP test from this that reproduces the issue:

  import QtQuick 2.4
  import Ubuntu.Components 1.3
  import Ubuntu.Components.Popups 1.3

  ListView {
      id: list
      width: 800
      height: 600

      model: ["A", "B", "C"]
      delegate: ListItem {
          Button {
              id: button
              text: modelData
              onTriggered: PopupUtils.open(popupComponent, button, {i: index})
          }
      }

      Component {
          id: popupComponent
          ActionSelectionPopover {
              id: popup
              property int i
              actions: ActionList {
                  Action {
                      text: "Delete"
                      onTriggered: {
                          var m = list.model
                          m.splice(popup.i, 1)
                          list.model = m
                      }
                  }
              }
          }
      }
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1504189/+subscriptions


References