Skip to content

Commit a71132a

Browse files
committedMar 29, 2017
Catch geos exception in event loop
1 parent 6aeb9b7 commit a71132a

File tree

3 files changed

+4
-39
lines changed

3 files changed

+4
-39
lines changed
 

‎src/core/geometry/qgsgeos.h

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -250,42 +250,14 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine
250250

251251
/// @cond PRIVATE
252252

253-
class GEOSException // clazy:exclude=rule-of-three
253+
254+
class GEOSException : public std::runtime_error
254255
{
255256
public:
256257
explicit GEOSException( const QString &message )
258+
: std::runtime_error( message.toUtf8().constData() )
257259
{
258-
if ( message == QLatin1String( "Unknown exception thrown" ) && lastMsg().isNull() )
259-
{
260-
msg = message;
261-
}
262-
else
263-
{
264-
msg = message;
265-
lastMsg() = msg;
266-
}
267-
}
268-
269-
// copy constructor
270-
GEOSException( const GEOSException &rhs )
271-
{
272-
*this = rhs;
273-
}
274-
275-
~GEOSException()
276-
{
277-
if ( lastMsg() == msg )
278-
lastMsg() = QString::null;
279-
}
280-
281-
QString what()
282-
{
283-
return msg;
284260
}
285-
286-
private:
287-
QString msg;
288-
static QString &lastMsg() { static QString sLastMsg; return sLastMsg; }
289261
};
290262

291263
/// @endcond

‎src/core/qgsapplication.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "qgsmessagelog.h"
3838
#include "qgsannotationregistry.h"
3939
#include "qgssettings.h"
40-
#include "qgsgeos.h"
4140

4241
#include "gps/qgsgpsconnectionregistry.h"
4342
#include "processing/qgsprocessingregistry.h"
@@ -314,12 +313,6 @@ bool QgsApplication::notify( QObject *receiver, QEvent *event )
314313
if ( qApp->thread() == QThread::currentThread() )
315314
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
316315
}
317-
catch ( GEOSException &e )
318-
{
319-
QgsDebugMsg( "Caught unhandled GEOSException: " + e.what() );
320-
if ( qApp->thread() == QThread::currentThread() )
321-
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
322-
}
323316
catch ( std::exception &e )
324317
{
325318
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );

‎src/core/qgstracer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ bool QgsTracer::initGraph()
550550

551551
mHasTopologyProblem = true;
552552

553-
QgsDebugMsg( "Tracer Noding Exception: " + e.what() );
553+
QgsDebugMsg( QString( "Tracer Noding Exception: %1" ).arg( e.what() ) );
554554
}
555555
#endif
556556

0 commit comments

Comments
 (0)
Please sign in to comment.