Make sure the content widget never replaces valid data with empty data.
authorChristian Kandeler <christian.kandeler@digia.com>
Fri, 26 Sep 2014 10:15:59 +0000 (12:15 +0200)
committerChristian Kandeler <christian.kandeler@digia.com>
Tue, 7 Oct 2014 09:27:20 +0000 (11:27 +0200)
commit3ab084b95d7b6f751473e43b4641e3b5deda2dfa
tree855e3d81d2432d4273b6cb1fe4d27a79c18b96de
parente83a2e0fa6f428223445defbd4730a39b4d6df7f
Make sure the content widget never replaces valid data with empty data.

This could happen because insertContents() is called once for
every run of the content provider, even if an invalidation happens
in between. Example sequence:
    run()
    invalidate() [removes result of first run]
    run()
    insertContents() [queued for first run, retrieves result of second run]
    insertContents() [queued for second run, retrieves empty data]
We now check in insertContents() whether the content provider has a
valid root item and do nothing if it does not. This means that
insertContents() will never replace the current model data with empty
data; only invalidateContents() can do that from now on.
Further improvements:
    - Only call insertContents() if the run was not aborted; this
      reduces the number of useless objects in the event queue.
    - Remove the m_rootItem member; it was only used in the run() function.
    - Only add the root item to the list at the end of a successful run;
      there is no reason this object should be accessible from the outside
      while there are still children being added to it.

Change-Id: I80e2ea93dd9bbc8ab7f406c989b61f16f11b6eea
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
tools/assistant/lib/qhelpcontentwidget.cpp