[Libreoffice-commits] core.git: svl/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Nov 1 21:36:36 UTC 2016


 svl/source/items/poolio.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 241dca2d8a667da08abbe234ab54ca83b802c768
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Nov 1 15:28:13 2016 +0200

    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 <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index c695bb9..4f474ec 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() )


More information about the Libreoffice-commits mailing list