[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 20 16:11:43 UTC 2019


 vcl/unx/generic/dtrans/X11_selection.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit e24b27cd1b3139f74c0e2c03dbf1045000ed220e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jun 20 13:57:13 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jun 20 18:10:30 2019 +0200

    gen vclplug crash on startup
    
    revert the failing hunk since...
    
    commit 452a8e4abe0c416d664078baddff67c1561025ec
    Date:   Sat Jun 15 17:13:48 2019 +0300
    
        Simplify Sequence iterations in vcl
    
    rTypes has been reduced in size by 1 by
    rTypes.realloc(pFlavors - rTypes.getArray());
    so has 8 elements, aNativeTypes still has 9
    and we fail in
    
    std::copy(aNativeTypes.begin(), aNativeTypes.end(), std::next(aNativeTemp.begin()));
    
    trying to put 9 elements inside space for 8
    
    Change-Id: Ie0031b2c4a980e15fa38d6e889f1474df506e893
    Reviewed-on: https://gerrit.libreoffice.org/74447
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index f8d675284a15..3e0900030027 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1331,16 +1331,19 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
         bSuccess = rTypes.hasElements();
         if( bHaveText && ! bHaveUTF16 )
         {
-            int nNewFlavors = rTypes.getLength()+1;
+            int i = 0;
 
+            int nNewFlavors = rTypes.getLength()+1;
             Sequence< DataFlavor > aTemp( nNewFlavors );
-            std::copy(rTypes.begin(), rTypes.end(), std::next(aTemp.begin()));
-            aTemp[0].MimeType = "text/plain;charset=utf-16";
-            aTemp[0].DataType = cppu::UnoType<OUString>::get();
+            for( i = 0; i < nNewFlavors-1; i++ )
+                aTemp.getArray()[i+1] = rTypes.getConstArray()[i];
+            aTemp.getArray()[0].MimeType = "text/plain;charset=utf-16";
+            aTemp.getArray()[0].DataType = cppu::UnoType<OUString>::get();
             rTypes = aTemp;
 
             std::vector< Atom > aNativeTemp( nNewFlavors );
-            std::copy(aNativeTypes.begin(), aNativeTypes.end(), std::next(aNativeTemp.begin()));
+            for( i = 0; i < nNewFlavors-1; i++ )
+                aNativeTemp[ i + 1 ] = aNativeTypes[ i ];
             aNativeTemp[0] = None;
             aNativeTypes = aNativeTemp;
         }


More information about the Libreoffice-commits mailing list