Fix contextdraganddropfeature and contexttaskremovefeature

Authored by dfaure on Jan 25 2019, 8:30 PM.

Description

Fix contextdraganddropfeature and contexttaskremovefeature

Summary:
This one was quite nasty... I mean challenging ;-)

When switching from a project page to a context page, the
ProjectPageModel instance gets deleted, which makes the proxy on top
(ZanshinContext's m_proxyModel) point to an empty source model.

That's fine, if the next call to setModel() sets a new source model
instead. But it wasn't doing that, because the just-deleted model and
the just-created model had the same pointer address, so the check
if (m_sourceModel == model) in setModel was true. This is how we
ended up with the "impossible situation" of a source model having 1 row,
and a non-filtering QSFPM having 0 rows (because it wasn't, in fact, on
top of that source model).

I fixed it with QPointer, the alternative would be more cleanups
in I_display_the_page(), we know very well that this method invalidates
the models...

Test Plan: ctest -R features

Reviewers: ervin

Reviewed By: ervin

Subscribers: Zanshin

Differential Revision: https://phabricator.kde.org/D18537

Details

Committed
dfaureJan 29 2019, 10:26 PM
Reviewer
ervin
Differential Revision
D18537: Fix contextdraganddropfeature and contexttaskremovefeature
Parents
R4:93593c489171: Change syntax for features tests, to make F2 work in QtCreator
Branches
Unknown
Tags
Unknown