Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unselected items in TabFileExplorer causes crash when version item is right clicked #141

Closed
fxdeniz opened this issue Jul 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working gui

Comments

@fxdeniz
Copy link
Owner

fxdeniz commented Jul 13, 2023

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.

@fxdeniz fxdeniz added bug Something isn't working gui labels Jul 13, 2023
@fxdeniz fxdeniz added this to the 2.0.0 milestone Jul 13, 2023
@fxdeniz fxdeniz self-assigned this Jul 13, 2023
@fxdeniz fxdeniz mentioned this issue Jul 13, 2023
2 tasks
@fxdeniz fxdeniz modified the milestones: 2.0.0, 1.0.0 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gui
Projects
None yet
Development

No branches or pull requests

1 participant