Skip to content

Don't add threaded messages to the UI before their parents

akwizgran requested to merge 1024-message-tree-npe into master

The crash in #1024 (closed) could happen in two ways:

  • A threaded message arrives and is added to the adapter while the rest of the messages, including its parent, are being loaded
  • A threaded message and its child arrive; the child is added to the adapter before the parent

I was able to reproduce the first cause but not the second. This branch prevents both causes.

The first cause is prevented by ignoring items with missing parents that are added to the adapter. The adapter's revision is incremented so that when the background load completes it will be repeated, picking up the ignored message. I've tested that this works as expected.

The second cause is prevented by attaching the message body to the event so it can be added to the adapter immediately rather than loaded asynchronously. The parent and child will be delivered to the client in dependency order, so the events will be fired and posted to the UI thread in dependency order.

This allows some refactoring of the UI, as the controller no longer needs to handle headers without bodies.

Closes #1024 (closed)

Edited by akwizgran

Merge request reports