Oh figured out.
I thought the process would go like:
model.itemChanged.signal -> databaseUpdate() -> setItem() -> tableUpdate()
But instead it was doing:
model.itemChanged.signal -> databaseUpdate() -> tableUpdate() -> setItem()
And since setItem was looking for a index item which was not there anymore(because it got updated), it crashed.
Fixed it by changing the setData return to 'True', or anything.