I thought Barristan's death was meant to show the futility of his ideals in the face of this new enemy.
Barristan brought wisdom governed by decades in service to the kings of Westeros, but none of his best intentions applied in Meereen. She told him to patrol the streets and keep her safe like he had done a million times before for other nobles, but it turned out to be his undoing.
Every major character death in the books/show follows the pattern of deconstructed ideal or vice.
Ned died for honor, Robb for love and honor, Catelyn for devotion, Joffrey for cruelty, Tywin for legacy, Renly for lusting after power, Oberyn for single-minded revenge, Viserys for ambition, Robert for drunkenness and pride, Ygritte for love, and the list goes on.
Every character is given a scenario where their best intentions are challenged. Their very nature is put to the test, and their response to that test determines whether they'll succeed.
There are thousands of pages, but it really boils down to a simple formula. Can a major character overcome their failing before someone or something kills them?