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>
Mon, 6 Oct 2014 10:22:26 +0000 (12:22 +0200)
commita1751e3d586f1ebfb1770392e52d7c1648a7406f
tree3ebffa74dd9d1c6a9ad772b529b36dcb9570d07c
parent9ee1ebecf13c44bf4eb987992356c04a7ab08ad4
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>
src/assistant/help/qhelpcontentwidget.cpp