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

Fix crash on value relation multi-column #54889

Merged

Conversation

elpaso
Copy link
Contributor

@elpaso elpaso commented Oct 9, 2023

Fix #54164

@elpaso elpaso added Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption backport queued_ltr_backports Queued Backports labels Oct 9, 2023
@github-actions github-actions bot added this to the 3.34.0 milestone Oct 9, 2023
{
whileBlocking( mTableWidget )->item( j, i )->setCheckState( Qt::PartiallyChecked );
if ( rowIndex * mColumnCount + columnIndex >= mCache.count() )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the problem that "item" returns null here? It might be cleaner to just go:

if ( currentItem = item( rowIndex, columnIndex) ) { ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the problem, but I find it cleaner this way: why would we want to iterate over a non-existing table item when we already know in advance that the index is overflowing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well the logic for sizing mCache and building checkbox widgets based on the size of mCache is somewhere else entirely, and there's a good chance that if someone messes with that logic they won't realise that this code even exists and needs updating accordingly.

@elpaso elpaso force-pushed the bugfix-54164-crash-value-relation-multi-column branch from e8e4fb9 to 2341d3f Compare October 10, 2023 09:43
@nyalldawson nyalldawson merged commit 03af4e3 into qgis:master Oct 10, 2023
29 of 31 checks passed
@qgis-bot
Copy link
Collaborator

The backport to release-3_28 failed:

The process '/usr/bin/git' failed with exit code 1
stderr
error: could not apply 2341d3f5810... Fix crash on value relation multi-column
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

stdout
Auto-merging src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
CONFLICT (content): Merge conflict in src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-3_28 release-3_28
# Navigate to the new working tree
cd .worktrees/backport-release-3_28
# Create a new branch
git switch --create backport-54889-to-release-3_28
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 2341d3f58104012263d64fcf809007e0a736fee3
# Push it to GitHub
git push --set-upstream origin backport-54889-to-release-3_28
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-3_28

Then, create a pull request where the base branch is release-3_28 and the compare/head branch is backport-54889-to-release-3_28.

@qgis-bot qgis-bot added the failed backport The automated backport attempt failed, needs a manual backport label Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption failed backport The automated backport attempt failed, needs a manual backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QGIS Crashes when editing multiple features simultaneously that have a Value Relation field
3 participants