It's annoyingly difficult to remove the links from the broadcaster, drop that approach and do it a more direct and less reentrant way. Get ~SwFormat and SwContentNode::ImplDestroy to report the death to the tracker instead. A flag on SwDoc keeps the common no-links case in those destructors to a single test. During ~SwDoc the hosts stay silent: the links administration manager can already be unreachable through the half-destroyed document, and ~FillBitmapLinkTracker releases whatever is left without touching the dead hosts. SwContentNode::ImplDestroy skips disconnected nodes, the stack-built working copies like SwTextNode::Update's SwContentNodeTmp that have no nodes-array and no SwDoc. A node deleted for real still reaches its SwDoc, since SwNodes::RemoveNode deletes nodes while they are still in the array. Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com> Change-Id: Ibbf15e4e17a7a08aa029c9d5df8f40b7a4a13e04 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4282 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins CPCI <releng@collaboraoffice.com> (cherry picked from commit 38ac5c0e6c7baf4de27498e5428d6279c753c97e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208603 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>