Skip to content

Commit

Permalink
Fix clazy connect-3arg-lambda warnings
Browse files Browse the repository at this point in the history
Always use 4 arg overload with a lambda, to avoid lambda
execution when context object is deleted.
  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent 1a32f08 commit a7470b3
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/app/qgisapp.cpp
Expand Up @@ -1831,7 +1831,7 @@ void QgisApp::createActions()
connect( mActionAddOgrLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "ogr" ) ); } );
connect( mActionAddRasterLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "gdal" ) ); } );
connect( mActionAddPgLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "postgres" ) ); } );
connect( mActionAddSpatiaLiteLayer, &QAction::triggered, [ = ] { dataSourceManager( QStringLiteral( "spatialite" ) ); } );
connect( mActionAddSpatiaLiteLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "spatialite" ) ); } );
connect( mActionAddMssqlLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "mssql" ) ); } );
connect( mActionAddDb2Layer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "DB2" ) ); } );
connect( mActionAddOracleLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "oracle" ) ); } );
Expand Down Expand Up @@ -5257,7 +5257,7 @@ bool QgisApp::addProject( const QString &projectFile )
0,
mInfoBar );

connect( btnEnableMacros, &QToolButton::clicked, [this, macroMsg]
connect( btnEnableMacros, &QToolButton::clicked, this, [this, macroMsg]
{
enableProjectMacros();
mInfoBar->popWidget( macroMsg );
Expand Down Expand Up @@ -8223,7 +8223,7 @@ void QgisApp::canvasRefreshStarted()
mRenderProgressBarTimer.setSingleShot( true );
mRenderProgressBarTimer.setInterval( 500 );
disconnect( mRenderProgressBarTimerConnection );
mRenderProgressBarTimerConnection = connect( &mRenderProgressBarTimer, &QTimer::timeout, [ = ]()
mRenderProgressBarTimerConnection = connect( &mRenderProgressBarTimer, &QTimer::timeout, this, [ = ]()
{
showProgress( -1, 0 );
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmapsavedialog.cpp
Expand Up @@ -118,7 +118,7 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co
connect( button, &QPushButton::clicked, this, &QgsMapSaveDialog::copyToClipboard );
}

connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsMapSaveDialog::accepted );
connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsMapSaveDialog::onAccepted );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsMapSaveDialog::showHelp );
}

Expand Down Expand Up @@ -349,7 +349,7 @@ void QgsMapSaveDialog::copyToClipboard()
mapRendererTask->addDecorations( mDecorations );
}

connect( mapRendererTask, &QgsMapRendererTask::renderingComplete, [ = ]
connect( mapRendererTask, &QgsMapRendererTask::renderingComplete, this, [ = ]
{
QApplication::clipboard()->setImage( *img, QClipboard::Clipboard );
QApplication::restoreOverrideCursor();
Expand All @@ -359,7 +359,7 @@ void QgsMapSaveDialog::copyToClipboard()
delete img;
setEnabled( true );
} );
connect( mapRendererTask, &QgsMapRendererTask::errorOccurred, [ = ]( int )
connect( mapRendererTask, &QgsMapRendererTask::errorOccurred, this, [ = ]( int )
{
QApplication::restoreOverrideCursor();
QgisApp::instance()->messageBar()->pushWarning( tr( "Save as PDF" ), tr( "Could not copy the map to clipboard" ) );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/raster/qgspalettedrendererwidget.cpp
Expand Up @@ -76,7 +76,7 @@ QgsPalettedRendererWidget::QgsPalettedRendererWidget( QgsRasterLayer *layer, con
mTreeView->setSelectionBehavior( QAbstractItemView::SelectRows );
mTreeView->setDefaultDropAction( Qt::MoveAction );

connect( mTreeView, &QTreeView::customContextMenuRequested, [ = ]( const QPoint & ) { mContextMenu->exec( QCursor::pos() ); }
connect( mTreeView, &QTreeView::customContextMenuRequested, this, [ = ]( const QPoint & ) { mContextMenu->exec( QCursor::pos() ); }
);

btnColorRamp->setShowRandomColorRamp( true );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
Expand Up @@ -55,7 +55,7 @@ QgsSingleBandPseudoColorRendererWidget::QgsSingleBandPseudoColorRendererWidget(
mColormapTreeWidget->setColumnWidth( ColorColumn, 50 );
mColormapTreeWidget->setContextMenuPolicy( Qt::CustomContextMenu );
mColormapTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
connect( mColormapTreeWidget, &QTreeView::customContextMenuRequested, [ = ]( const QPoint & ) { contextMenu->exec( QCursor::pos() ); }
connect( mColormapTreeWidget, &QTreeView::customContextMenuRequested, this, [ = ]( const QPoint & ) { contextMenu->exec( QCursor::pos() ); }
);

QString defaultPalette = settings.value( QStringLiteral( "Raster/defaultPalette" ), "" ).toString();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
Expand Up @@ -1047,7 +1047,7 @@ void QgsCategorizedSymbolRendererWidget::dataDefinedSizeLegend()
QgsDataDefinedSizeLegendWidget *panel = createDataDefinedSizeLegendWidget( s, mRenderer->dataDefinedSizeLegend() );
if ( panel )
{
connect( panel, &QgsPanelWidget::widgetChanged, [ = ]
connect( panel, &QgsPanelWidget::widgetChanged, this, [ = ]
{
mRenderer->setDataDefinedSizeLegend( panel->dataDefinedSizeLegend() );
emit widgetChanged();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgsdatadefinedsizelegendwidget.cpp
Expand Up @@ -110,7 +110,7 @@ QgsDataDefinedSizeLegendWidget::QgsDataDefinedSizeLegendWidget( const QgsDataDef
mPreviewModel->setLegendMapViewData( canvas->mapUnitsPerPixel(), canvas->mapSettings().outputDpi(), canvas->scale() );
viewLayerTree->setModel( mPreviewModel );

connect( cboAlignSymbols, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), [ = ] { emit widgetChanged(); } );
connect( cboAlignSymbols, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, [ = ] { emit widgetChanged(); } );
connect( radDisabled, &QRadioButton::clicked, this, &QgsPanelWidget::widgetChanged );
connect( radSeparated, &QRadioButton::clicked, this, &QgsPanelWidget::widgetChanged );
connect( radCollapsed, &QRadioButton::clicked, this, &QgsPanelWidget::widgetChanged );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
Expand Up @@ -1179,7 +1179,7 @@ void QgsGraduatedSymbolRendererWidget::dataDefinedSizeLegend()
QgsDataDefinedSizeLegendWidget *panel = createDataDefinedSizeLegendWidget( s, mRenderer->dataDefinedSizeLegend() );
if ( panel )
{
connect( panel, &QgsPanelWidget::widgetChanged, [ = ]
connect( panel, &QgsPanelWidget::widgetChanged, this, [ = ]
{
mRenderer->setDataDefinedSizeLegend( panel->dataDefinedSizeLegend() );
emit widgetChanged();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgssinglesymbolrendererwidget.cpp
Expand Up @@ -122,7 +122,7 @@ void QgsSingleSymbolRendererWidget::dataDefinedSizeLegend()
QgsDataDefinedSizeLegendWidget *panel = createDataDefinedSizeLegendWidget( s, mRenderer->dataDefinedSizeLegend() );
if ( panel )
{
connect( panel, &QgsPanelWidget::widgetChanged, [ = ]
connect( panel, &QgsPanelWidget::widgetChanged, this, [ = ]
{
mRenderer->setDataDefinedSizeLegend( panel->dataDefinedSizeLegend() );
emit widgetChanged();
Expand Down
14 changes: 7 additions & 7 deletions src/gui/symbology/qgsstylemanagerdialog.cpp
Expand Up @@ -69,15 +69,15 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent )

connect( listItems, &QAbstractItemView::doubleClicked, this, &QgsStyleManagerDialog::editItem );

connect( btnAddItem, &QPushButton::clicked, [ = ]( bool ) { addItem(); }
connect( btnAddItem, &QPushButton::clicked, this, [ = ]( bool ) { addItem(); }
);
connect( btnEditItem, &QPushButton::clicked, [ = ]( bool ) { editItem(); }
connect( btnEditItem, &QPushButton::clicked, this, [ = ]( bool ) { editItem(); }
);
connect( actnEditItem, &QAction::triggered, [ = ]( bool ) { editItem(); }
connect( actnEditItem, &QAction::triggered, this, [ = ]( bool ) { editItem(); }
);
connect( btnRemoveItem, &QPushButton::clicked, [ = ]( bool ) { removeItem(); }
connect( btnRemoveItem, &QPushButton::clicked, this, [ = ]( bool ) { removeItem(); }
);
connect( actnRemoveItem, &QAction::triggered, [ = ]( bool ) { removeItem(); }
connect( actnRemoveItem, &QAction::triggered, this, [ = ]( bool ) { removeItem(); }
);

QMenu *shareMenu = new QMenu( tr( "Share menu" ), this );
Expand Down Expand Up @@ -178,10 +178,10 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent )
mGroupTreeContextMenu = new QMenu( this );
connect( actnEditSmartGroup, &QAction::triggered, this, &QgsStyleManagerDialog::editSmartgroupAction );
mGroupTreeContextMenu->addAction( actnEditSmartGroup );
connect( actnAddTag, &QAction::triggered, [ = ]( bool ) { addTag(); }
connect( actnAddTag, &QAction::triggered, this, [ = ]( bool ) { addTag(); }
);
mGroupTreeContextMenu->addAction( actnAddTag );
connect( actnAddSmartgroup, &QAction::triggered, [ = ]( bool ) { addSmartgroup(); }
connect( actnAddSmartgroup, &QAction::triggered, this, [ = ]( bool ) { addSmartgroup(); }
);
mGroupTreeContextMenu->addAction( actnAddSmartgroup );
connect( actnRemoveGroup, &QAction::triggered, this, &QgsStyleManagerDialog::removeGroup );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/arcgisrest/qgsafsdataitems.cpp
Expand Up @@ -60,7 +60,7 @@ QList<QAction *> QgsAfsRootItem::actions( QWidget *parent )
QWidget *QgsAfsRootItem::paramWidget()
{
QgsAfsSourceSelect *select = new QgsAfsSourceSelect( 0, 0, QgsProviderRegistry::WidgetMode::Manager );
connect( select, &QgsArcGisServiceSourceSelect::connectionsChanged, this, &QgsAfsRootItem::connectionsChanged );
connect( select, &QgsArcGisServiceSourceSelect::connectionsChanged, this, &QgsAfsRootItem::onConnectionsChanged );
return select;
}

Expand Down

0 comments on commit a7470b3

Please sign in to comment.