Kaydet (Commit) 5031e17d authored tarafından Michael Stahl's avatar Michael Stahl

fix RenameHdl in previous commit:

::boost::ptr_vector::erase will delete the element, so p points to freed
memory after that line; try to get this to work via the transfer method.
üst 60473b5e
...@@ -472,21 +472,22 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) ...@@ -472,21 +472,22 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
if( n >= pTableTbl->size() ) if( n >= pTableTbl->size() )
{ {
// Format mit dem Namen noch nicht vorhanden, also // no format with this name exists, so rename it
// umbenennen
aLbFormat.RemoveEntry( nDfltStylePos + nIndex ); aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
SwTableAutoFmt* p = &(*pTableTbl)[ nIndex ]; SwTableAutoFmt* p = &(*pTableTbl)[ nIndex ];
pTableTbl->erase( pTableTbl->begin() + nIndex );
p->SetName( aFormatName ); p->SetName( aFormatName );
// Sortiert einfuegen!! // keep all arrays sorted!
for( n = 1; n < pTableTbl->size(); ++n ) for( n = 1; n < pTableTbl->size(); ++n )
if( (*pTableTbl)[ n ].GetName() > aFormatName ) if ((n != nIndex) &&
((*pTableTbl)[n].GetName() > aFormatName))
{
break; break;
}
pTableTbl->insert( pTableTbl->begin() + n, p ); pTableTbl->transfer(pTableTbl->begin() + n,
pTableTbl->begin() + nIndex, *pTableTbl);
aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n ); aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
aLbFormat.SelectEntryPos( nDfltStylePos + n ); aLbFormat.SelectEntryPos( nDfltStylePos + n );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment