ProjectModel::pathToIndex assert when path not found?

David Nolden david.nolden.kdevelop at art-master.de
Sat Jul 25 08:51:45 UTC 2009


Am Samstag 25 Juli 2009 10:28:42 schrieb Niko Sams:
> Hi,
>
> When editing in a launch config the project target
> ProjectModel::pathToIndex is called to
> find the project item. As it's a lineedit invalid paths are possible
> and while typing an assertion
> in ProjectModel::pathToIndex triggers.
>
> solution would be to simply remove the assertion and return an invalid
> QModelIndex if the item
> can't be found. (ProjectItemValidator actually checks already for that)
>
> diff --git a/kdevplatform/project/projectmodel.cpp
> b/kdevplatform/project/projectmodel.cpp
> index 181445e..435fb7f 100644
> --- a/kdevplatform/project/projectmodel.cpp
> +++ b/kdevplatform/project/projectmodel.cpp
> @@ -471,7 +471,6 @@ QModelIndex ProjectModel::pathToIndex(const
> QStringList& tofetch_) const
>              }
>          }
>      }
> -    Q_ASSERT(!ret.isValid() || data(ret).toString()==tofetch.last());
>      return ret;
>  }
>
> Ok to commit?

Actually the assertion seems to allow invalid paths. So the problem seems to 
be "data(ret).toString()==tofetch.last()". I guess that's a bug in the fix 
I've committed there yesterday. I'll commit one more fix in a second.

Greetings, David





More information about the KDevelop-devel mailing list