Skip to content

Commit

Permalink
Fix leak of QgsWindow3DEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 4, 2020
1 parent ea8c67b commit 7f6dda0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/3d/qgsabstract3dengine.cpp
Expand Up @@ -14,3 +14,9 @@
***************************************************************************/

#include "qgsabstract3dengine.h"

QgsAbstract3DEngine::QgsAbstract3DEngine( QObject *parent )
: QObject( parent )
{

}
5 changes: 5 additions & 0 deletions src/3d/qgsabstract3dengine.h
Expand Up @@ -58,6 +58,11 @@ class _3D_EXPORT QgsAbstract3DEngine : public QObject
Q_OBJECT
public:

/**
* Constructor for QgsAbstract3DEngine with the specified \a parent object.
*/
QgsAbstract3DEngine( QObject *parent = nullptr );

//! Sets background color of the scene
virtual void setClearColor( const QColor &color ) = 0;
//! Sets whether frustum culling is enabled (this should make rendering faster by not rendering entities outside of camera's view)
Expand Down
3 changes: 2 additions & 1 deletion src/3d/qgswindow3dengine.cpp
Expand Up @@ -20,7 +20,8 @@
#include <Qt3DExtras/QForwardRenderer>


QgsWindow3DEngine::QgsWindow3DEngine()
QgsWindow3DEngine::QgsWindow3DEngine( QObject *parent )
: QgsAbstract3DEngine( parent )
{
mWindow3D = new Qt3DExtras::Qt3DWindow;

Expand Down
6 changes: 5 additions & 1 deletion src/3d/qgswindow3dengine.h
Expand Up @@ -47,7 +47,11 @@ class _3D_EXPORT QgsWindow3DEngine : public QgsAbstract3DEngine
{
Q_OBJECT
public:
QgsWindow3DEngine();

/**
* Constructor for QgsWindow3DEngine with the specified \a parent object.
*/
QgsWindow3DEngine( QObject *parent = nullptr );

//! Returns the internal 3D window where all the rendered output is displayed
QWindow *window();
Expand Down
2 changes: 1 addition & 1 deletion src/app/3d/qgs3dmapcanvas.cpp
Expand Up @@ -34,7 +34,7 @@ Qgs3DMapCanvas::Qgs3DMapCanvas( QWidget *parent )
: QWidget( parent )
{
QgsSettings setting;
mEngine = new QgsWindow3DEngine;
mEngine = new QgsWindow3DEngine( this );

connect( mEngine, &QgsAbstract3DEngine::imageCaptured, this, [ = ]( const QImage & image )
{
Expand Down

0 comments on commit 7f6dda0

Please sign in to comment.