ActionSelectionPopover's CPO click_action_button fails if we destroy the popover as result of an action
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-ui-toolkit (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
When using the click_action_button of the Custom Proxy Object for ActionSelection
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.
ListView {
id: list
width: 800
height: 600
model: ["A", "B", "C"]
delegate: ListItem {
Button {
id: button
text: modelData
}
}
Component {
id: popupComponent
id: popup
}
}
}
}
}
Status changed to 'Confirmed' because the bug affects multiple users.