bgo#687196 - Fix model corruption during file removal
bgo#687196 - Fix model corruption during file removal

The main problem is that we were emitting the row-deleted signal for the model in the middle
of the process that actually deletes the row from the model (remove the row from the array,
update the model->file_lookup hash table, etc.).  In the model's caller, one of the row-deleted
callbacks was requesting an iter, which caused the model to revalidate itself - but it did
this while it was in an inconsistent state.  This led to an assertion failure later when the
model resorted itself.

The fix in remove_file() is like this:

* The filteredness/visibility of the deleted node is not updated.  The
  node will simply be gone; we don't need to update those values at
  all.

* We invalidate just the node that is being deleted.

* The model->file_lookup hash table is not completely nuked; instead,
  we carefully adjust its indices.

* The row-deleted signal is only emitted at the very end, when
  deletion is complete and the model is consistent.

Many thanks to William Hua for doing the detective work on this bug!

Signed-off-by: Federico Mena Quintero <4999915a961edfd7686112c2935288e1266eae14@gnome.org>

bratsche/gtk-,jigpu/gtk,chergert/gtk,msteinert/gtk,ebassi/gtk,Adamovskiy/gtk,jigpu/gtk,Lyude/gtk-,jigpu/gtk,Adamovskiy/gtk,Sidnioulz/SandboxGtk,bratsche/gtk-,bratsche/gtk-,ahodesuka/gtk,jigpu/gtk,msteinert/gtk,jessevdk/gtk,chergert/gtk,jadahl/gtk,grubersjoe/adwaita,alexlarsson/gtk,msteinert/gtk,davidgumberg/gtk,davidt/gtk,Adamovskiy/gtk,Sidnioulz/SandboxGtk,grubersjoe/adwaita,davidt/gtk,ahodesuka/gtk,Adamovskiy/gtk,davidgumberg/gtk,bratsche/gtk-,jadahl/gtk,Lyude/gtk-,Sidnioulz/SandboxGtk,davidgumberg/gtk,alexlarsson/gtk,Adamovskiy/gtk,msteinert/gtk,davidgumberg/gtk,msteinert/gtk,bratsche/gtk-,jadahl/gtk,davidt/gtk,grubersjoe/adwaita,grubersjoe/adwaita,Lyude/gtk-,jessevdk/gtk,Distrotech/gtk2,davidt/gtk,davidt/gtk,chergert/gtk,jigpu/gtk,chergert/gtk,ahodesuka/gtk,Distrotech/gtk2,ebassi/gtk,alexlarsson/gtk,davidgumberg/gtk,Lyude/gtk-,ebassi/gtk,davidgumberg/gtk,Distrotech/gtk2,Distrotech/gtk2,Adamovskiy/gtk,chergert/gtk,Lyude/gtk-,ahodesuka/gtk,jessevdk/gtk,jadahl/gtk,ahodesuka/gtk,jadahl/gtk,Lyude/gtk-,Adamovskiy/gtk,ebassi/gtk,alexlarsson/gtk,msteinert/gtk,jigpu/gtk,grubersjoe/adwaita,chergert/gtk,bratsche/gtk-,jessevdk/gtk,ebassi/gtk,jadahl/gtk,Lyude/gtk-,davidgumberg/gtk,Sidnioulz/SandboxGtk,jadahl/gtk,Distrotech/gtk2,alexlarsson/gtk,jigpu/gtk,grubersjoe/adwaita,alexlarsson/gtk,alexlarsson/gtk,ahodesuka/gtk,davidgumberg/gtk,grubersjoe/adwaita,Lyude/gtk-,jadahl/gtk,ahodesuka/gtk,chergert/gtk,alexlarsson/gtk,Sidnioulz/SandboxGtk,davidt/gtk,chergert/gtk,Sidnioulz/SandboxGtk,grubersjoe/adwaita,ebassi/gtk,ahodesuka/gtk,jessevdk/gtk,Adamovskiy/gtk,jessevdk/gtk,jigpu/gtk,Distrotech/gtk2,jessevdk/gtk