When item from version list is right clicked, causes access to a null pointer.
This only happens when user right clicked to a version item but item from table view is not selected. This means, user first needs to select item from tableview which will load the versions into listview. After that, user will click to empty place in tableview. Now, tableview has lost the selected index but listview still holds the indexes for selected item of tableview. Finally, user right clicks to item in listview which causes access to a empty index of tableview.
Access to null pointer happens marked in this code snippet:
void TabFileExplorer::showContextMenuListView(const QPoint &argPos)
{
QAbstractItemView *subjectView = ui->listView;
QModelIndex index = subjectView->indexAt(argPos);
if(index.isValid()) // If user selected an item from list.
{
auto tableModel = (TableModelFileExplorer *) ui->tableView->model();
QModelIndex tableModelIndex = ui->tableView->selectionModel()->selectedRows().first(); <--- HERE
// Rest is omitted.
}
}
Steps to re-produce this bug:
1 - Select a file from tableview.
2 - Click to empty place on tableview.
3 - Right click to an item from listview.
Solution:
When user clicks to empty area in tableview, listview also needs to be cleared.
When item from version list is right clicked, causes access to a null pointer. This only happens when user right clicked to a version item but item from table view is not selected. This means, user first needs to select item from tableview which will load the versions into listview. After that, user will click to empty place in tableview. Now, tableview has lost the selected index but listview still holds the indexes for selected item of tableview. Finally, user right clicks to item in listview which causes access to a empty index of tableview.
Access to null pointer happens marked in this code snippet:
Steps to re-produce this bug: 1 - Select a file from tableview. 2 - Click to empty place on tableview. 3 - Right click to an item from listview.
Solution: When user clicks to empty area in tableview, listview also needs to be cleared.