Skip to content
Commit bbf021c6 authored by Igor Kushnir's avatar Igor Kushnir
Browse files

Actually show empty-pattern project filter error

I have discovered this bug thanks to the following GCC warning:
warning: loop variable ‘filter’ of type ‘const KDevelop::Filter&’ binds to a temporary constructed from type ‘const KDevelop::SerializedFilter’ [-Wrange-loop-construct]
  162 |     for (const Filter& filter : filters) {
      |                        ^~~~~~
note: use non-reference type ‘const KDevelop::Filter’ to make the copy explicit or ‘const KDevelop::SerializedFilter&’ to prevent copying

Filter::Filter(const SerializedFilter& filter) prepends "*/" to an empty
pattern. So, aside from the inefficiency of constructing a temporary
Filter object, the bug prevented displaying the empty-pattern error.

The project filter validation was implemented in
59ed3308. The very next commit on the
next day - a15b683d - changed the type
of FilterModel::filters() from Filters to SerializedFilters and
introduced the bug. So the empty-pattern error must have been seen only
by its implementer during development testing.

Simply changing the type of the loop variable from Filter& to auto&
shows the empty-pattern error as soon as the user adds a new filter.
Prevent this annoyance by not rechecking filters when a row is inserted
(and when a row is moved, for good measure, to skip useless work).
parent 326bdd63
Pipeline #128553 passed with stage
in 33 minutes and 22 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment