Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Non-leaky approach to singleshot timer
  • Loading branch information
nyalldawson committed Oct 7, 2020
1 parent 6da6a45 commit 6abe3b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/app/qgisappinterface.cpp
Expand Up @@ -780,12 +780,10 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b

void QgisAppInterface::preloadForm( const QString &uifile )
{
mTimer = new QTimer( this );

connect( mTimer, &QTimer::timeout, mTimer, &QTimer::stop );
connect( mTimer, &QTimer::timeout, this, [ = ] { cacheloadForm( uifile ); } );

mTimer->start( 0 );
QTimer::singleShot( 0, this, [ = ]
{
cacheloadForm( uifile );
} );
}

void QgisAppInterface::cacheloadForm( const QString &uifile )
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgisappinterface.h
Expand Up @@ -325,8 +325,6 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
//! Pointer to the QgisApp object
QgisApp *qgis = nullptr;

QTimer *mTimer = nullptr;

//! Pointer to the PluginManagerInterface object
QgsAppPluginManagerInterface pluginManagerIface;
};
Expand Down

0 comments on commit 6abe3b6

Please sign in to comment.