Skip to content

Commit

Permalink
Defer connection deletion until everything has cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 16, 2022
1 parent 9b8be60 commit 5579a4e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/gps/qgsappgpsconnection.cpp
Expand Up @@ -160,15 +160,17 @@ void QgsAppGpsConnection::disconnectGps()
{
if ( mConnection )
{
QgsApplication::gpsConnectionRegistry()->unregisterConnection( mConnection );
delete mConnection;
// we don't actually delete the connection until everything has had time to respond to the cleanup signals
std::unique_ptr< QgsGpsConnection > oldConnection( mConnection );
mConnection = nullptr;

emit disconnected();
emit statusChanged( Qgis::GpsConnectionStatus::Disconnected );
emit fixStatusChanged( Qgis::GpsFixStatus::NoData );

showStatusBarMessage( tr( "Disconnected from GPS device." ) );

QgsApplication::gpsConnectionRegistry()->unregisterConnection( oldConnection.get() );
}
}

Expand Down

0 comments on commit 5579a4e

Please sign in to comment.