Skip to content

Commit

Permalink
[win] Cleanup notifications on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 31, 2018
1 parent 8f1fb1e commit b55ab2e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -1532,6 +1532,8 @@ QgisApp::~QgisApp()
delete canvas;
}

QgsGui::instance()->nativePlatformInterface()->cleanup();

// This function *MUST* be the last one called, as it destroys in
// particular GDAL. As above objects can hold GDAL/OGR objects, it is not
// safe destroying them afterwards
Expand Down
3 changes: 3 additions & 0 deletions src/native/qgsnative.cpp
Expand Up @@ -21,6 +21,9 @@
#include <QUrl>
#include <QFileInfo>

void QgsNative::cleanup()
{}

QgsNative::Capabilities QgsNative::capabilities() const
{
return nullptr;
Expand Down
6 changes: 6 additions & 0 deletions src/native/qgsnative.h
Expand Up @@ -46,6 +46,12 @@ class NATIVE_EXPORT QgsNative

virtual ~QgsNative() = default;

/**
* Called on QGIS exit, allowing the native interface to gracefully
* cleanup and exit.
*/
virtual void cleanup();

/**
* Returns the native interface's capabilities.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/native/win/qgswinnative.cpp
Expand Up @@ -58,6 +58,11 @@ void QgsWinNative::initializeMainWindow( QWindow *window,
}
}

void QgsWinNative::cleanup()
{
WinToastLib::WinToast::instance()->clear();
}

void QgsWinNative::openFileExplorerAndSelectFile( const QString &path )
{
const QString nativePath = QDir::toNativeSeparators( path );
Expand Down
1 change: 1 addition & 0 deletions src/native/win/qgswinnative.h
Expand Up @@ -35,6 +35,7 @@ class NATIVE_EXPORT QgsWinNative : public QgsNative
const QString &applicationName,
const QString &organizationName,
const QString &version ) override;
void cleanup() override;
void openFileExplorerAndSelectFile( const QString &path ) override;
void showUndefinedApplicationProgress() override;
void setApplicationProgress( double progress ) override;
Expand Down

0 comments on commit b55ab2e

Please sign in to comment.