Skip to content
Permalink
Browse files

fix crash - clone the columns

  • Loading branch information
3nids committed May 6, 2020
1 parent 525661c commit e7fe141b25683d2ace594801dcad5dcf76be4a91
Showing with 6 additions and 2 deletions.
  1. +3 −1 src/core/layout/qgscompositionconverter.cpp
  2. +3 −1 src/core/layout/qgslayouttable.cpp
@@ -1469,7 +1469,9 @@ bool QgsCompositionConverter::readTableXml( QgsLayoutItemAttributeTable *layoutI

// sorting columns are now (QGIS 3.14+) handled in a dedicated list
Q_NOWARN_DEPRECATED_PUSH
std::copy_if( layoutItem->mColumns.begin(), layoutItem->mColumns.end(), std::back_inserter( layoutItem->mSortColumns ), []( QgsLayoutTableColumn * col ) {return col->sortByRank() > 0;} );
for ( QgsLayoutTableColumn *col : qgis::as_const( layoutItem->mColumns ) )
if ( col->sortByRank() > 0 )
layoutItem->mSortColumns.append( col->clone() );
std::sort( layoutItem->mSortColumns.begin(), layoutItem->mSortColumns.end(), []( QgsLayoutTableColumn * a, QgsLayoutTableColumn * b ) {return a->sortByRank() < b->sortByRank();} );
Q_NOWARN_DEPRECATED_POP
}
@@ -196,7 +196,9 @@ bool QgsLayoutTable::readPropertiesFromElement( const QDomElement &itemElem, con
{
// backward compatibility for QGIS < 3.14
Q_NOWARN_DEPRECATED_PUSH
std::copy_if( mColumns.begin(), mColumns.end(), std::back_inserter( mSortColumns ), []( QgsLayoutTableColumn * col ) {return col->sortByRank() > 0;} );
for ( QgsLayoutTableColumn *col : qgis::as_const( mColumns ) )
if ( col->sortByRank() > 0 )
mSortColumns.append( col->clone() );
std::sort( mSortColumns.begin(), mSortColumns.end(), []( QgsLayoutTableColumn * a, QgsLayoutTableColumn * b ) {return a->sortByRank() < b->sortByRank();} );
Q_NOWARN_DEPRECATED_POP
}

0 comments on commit e7fe141

Please sign in to comment.
You can’t perform that action at this time.