From 241dca2d8a667da08abbe234ab54ca83b802c768 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 1 Nov 2016 15:28:13 +0200 Subject: [PATCH] add an assert to check for ref-counts > 16 bits after commit 87c518593de59dbf4c0f5f45c720b14a05aeca9e sc: remove antique reference counting hacks from ScDocumentPool In theory, nothing should be trying to save items like this anymore, but lets make the error more obvious in case something is. Change-Id: I89b3637168c072d20e214a8f6338f6336d44d891 Reviewed-on: https://gerrit.libreoffice.org/30467 Reviewed-by: Michael Stahl Tested-by: Michael Stahl --- svl/source/items/poolio.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index c695bb92788b..4f474ec787c3 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -258,9 +258,13 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const rStream.WriteUInt16( convertSfxItemKindToUInt16(pItem->GetKind()) ); else { - rStream.WriteUInt16( pItem->GetRefCount() ); if( pItem->GetRefCount() > SFX_ITEMS_OLD_MAXREF ) + { + assert(!"refcount does not fit into 16-bits"); rStream.SetError( ERRCODE_IO_NOTSTORABLEINBINARYFORMAT ); + } + else + rStream.WriteUInt16( pItem->GetRefCount() ); } if ( !rStream.GetError() )