Skip to content

Map ObsListDialog index from proxy model back to the source#4241

Merged
alex-w merged 1 commit into
Stellarium:masterfrom
moble:observing_list_crash
Mar 22, 2025
Merged

Map ObsListDialog index from proxy model back to the source#4241
alex-w merged 1 commit into
Stellarium:masterfrom
moble:observing_list_crash

Conversation

@moble
Copy link
Copy Markdown
Contributor

@moble moble commented Mar 22, 2025

Description

I contributed #4098, but failed to notice that after sorting, when you double-click on a row, it segfaults.

This PR fixes the segfault. The problem was that the double‐click slot is using an index from a proxy model without mapping it back to the source (itemModel). When you sort the tree view, you set a new proxy model on the view. Then the QModelIndex passed to selectAndGoToObject belongs to the proxy and must be mapped back to the source model before calling itemModel->itemFromIndex().

Screenshots (if appropriate):

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

I've built the code, run it, and tested on my own observing list — including double-clicking on a row.

Test Configuration:

  • Operating system: macOS 14.6.1
  • Graphics Card: Apple M2 Max (Metal 3)

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@github-actions
Copy link
Copy Markdown

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

This is an automatically generated QA checklist based on modified files.

@alex-w alex-w added this to the 25.1 milestone Mar 22, 2025
Copy link
Copy Markdown
Member

@alex-w alex-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fix!

@alex-w alex-w merged commit 58a0884 into Stellarium:master Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants