Skip to content

Commit 014f070

Browse files
committed
gps information widget:
* fix crash when satellite markers are remove (fixes #12393) * also fixes serial port detection on unix
1 parent fa89e29 commit 014f070

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/app/gps/qgsgpsinformationwidget.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,10 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
544544
#if (WITH_QWTPOLAR)
545545
if ( mStackedWidget->currentIndex() == 2 && info.satInfoComplete ) //satellites
546546
{
547-
qDeleteAll( mMarkerList );
547+
while ( !mMarkerList.isEmpty() )
548+
{
549+
delete mMarkerList.takeFirst();
550+
}
548551
} //satellites
549552
#endif
550553
if ( mStackedWidget->currentIndex() == 4 ) //debug

src/core/gps/qgsgpsdetector.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ QList< QPair<QString, QString> > QgsGPSDetector::availablePorts()
3838
#if defined(HAVE_QT_MOBILITY_LOCATION ) || defined(QT_POSITIONING_LIB)
3939
devs << QPair<QString, QString>( "internalGPS", tr( "internal GPS" ) );
4040
#endif
41+
4142
// try local gpsd first
4243
devs << QPair<QString, QString>( "localhost:2947:", tr( "local gpsd" ) );
4344

44-
#ifdef linux
45+
#ifdef Q_OS_LINUX
4546
// look for linux serial devices
4647
foreach ( QString linuxDev, QStringList() << "/dev/ttyS%1" << "/dev/ttyUSB%1" << "/dev/rfcomm%1" << "/dev/ttyACM%1" )
4748
{
@@ -55,7 +56,7 @@ QList< QPair<QString, QString> > QgsGPSDetector::availablePorts()
5556
}
5657
#endif
5758

58-
#ifdef __FreeBSD__ // freebsd
59+
#ifdef Q_OS_FREEBSD
5960
// and freebsd devices (untested)
6061
foreach ( QString freebsdDev, QStringList() << "/dev/cuaa%1" << "/dev/ucom%1" )
6162
{
@@ -69,7 +70,7 @@ QList< QPair<QString, QString> > QgsGPSDetector::availablePorts()
6970
}
7071
#endif
7172

72-
#ifdef sparc
73+
#ifdef Q_OS_SOLARIS
7374
// and solaris devices (also untested)
7475
QString solarisDev( "/dev/cua/%1" );
7576
for ( char i = 'a'; i < 'k'; ++i )
@@ -161,7 +162,6 @@ void QgsGPSDetector::advance()
161162
qWarning( "QT_MOBILITY_LOCATION not found and mPortList matches internalGPS, this should never happen" );
162163
#endif
163164
}
164-
165165
else
166166
{
167167
QextSerialPort *serial = new QextSerialPort( mPortList[ mPortIndex ].first, QextSerialPort::EventDriven );

0 commit comments

Comments
 (0)