Skip to content

Fixed silent crash and filter input behaviour for numbers#4457

Open
gabriel-bolbotina wants to merge 2 commits intodev/filteringfrom
filter-fix-crash
Open

Fixed silent crash and filter input behaviour for numbers#4457
gabriel-bolbotina wants to merge 2 commits intodev/filteringfrom
filter-fix-crash

Conversation

@gabriel-bolbotina
Copy link
Copy Markdown
Contributor

@gabriel-bolbotina gabriel-bolbotina commented Apr 17, 2026

  • Fixed silent crashes that occurred when a filter was added to the project without a layer or field in plugin, that would lead to a silent crash in the app. Now we skip these filters and I added logging messages for them. Also, I added some guards for other potential silent crashes.
  • Fixed checked status for filter inputs which was broken when inputting text, numbers or dates.
  • Added support for negative numbers and 0 as inputs for number range filters
  • fixed the false checked status for dropdown filter types

Added logging for these scenarios
Fixed checked status for filter inputs
added guards for other potential silent crashes
added support for negative numbers and 0 as inputs for number range filters
@gabriel-bolbotina gabriel-bolbotina added this to the 2026.2.0 milestone Apr 17, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 17, 2026

Coverage Report for CI Build 24560858057

Warning

No base build found for commit 5222fcf on dev/filtering.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 58.114%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 15153
Covered Lines: 8806
Line Coverage: 58.11%
Coverage Strength: 100.71 hits per line

💛 - Coveralls

@github-actions
Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 67091 dmg Expires: 16/07/2026 #6709
linux Build 📬 Mergin Maps 67201 x86_64 Expires: 16/07/2026 #6720
win64 Build 📬 Mergin Maps 59041 win64 Expires: 16/07/2026 #5904
Android Build 📬 Mergin Maps 802151 APK [arm64-v8a] Expires: 16/07/2026 #8021
📬 Mergin Maps 802151 APK [arm64-v8a] Google Play Store #8021
Android Build 📬 Mergin Maps 802111 APK [armeabi-v7a] Expires: 16/07/2026 #8021
📬 Mergin Maps 802111 APK [armeabi-v7a] Google Play Store #8021
iOS Build 📬 Build number: 26.04.896011 #8960

Copy link
Copy Markdown
Contributor

@Withalion Withalion left a comment

Choose a reason for hiding this comment

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

In general I would prefer triggering the logging when the filter tries to get applied and fails instead of when the filter is loaded from QgsProject

Comment thread app/filtercontroller.cpp
Comment on lines +35 to +40
if ( !vectorLayer )
{
CoreUtils::log( QStringLiteral( "Feature Filtering" ),
QStringLiteral( "Layer '%1' is not available. Cannot clear its filters." ).arg( layerId ) );
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this doesn't seem necessary as this function gets the layerID passed from the selected layer by user and not from filter

Comment thread app/filtercontroller.cpp
Comment on lines +140 to +147
const QgsVectorLayer *filterLayer = qobject_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( newFieldFilter.layerId ) );
if ( !filterLayer )
{
CoreUtils::log( QStringLiteral( "Feature Filtering" ),
QStringLiteral( "Layer '%1' for filter '%2' is not available in the project. Skipping filter." )
.arg( newFieldFilter.layerId, newFieldFilter.filterName ) );
continue;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wouldn't do the check here, but when creating the filter expression

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, QgsProject is passed to this function

Comment thread app/filtercontroller.cpp
Comment on lines +384 to +389
if ( !layer )
{
CoreUtils::log( QStringLiteral( "Feature Filtering" ),
QStringLiteral( "Layer '%1' is not available. Cannot check active filter." ).arg( layerId ) );
return false;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This function again gets passed layerID from layer which needs to exist or the user wouldn't be able to navigate to where this function gets triggered

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