Skip to content

Commit

Permalink
Wait for threads on exit.
Browse files Browse the repository at this point in the history
Move the fixups that were in renderings tests to QgsApplication::exitQgis
  • Loading branch information
Hugo Mercier authored and nirvn committed Sep 11, 2019
1 parent cf642be commit fb832d2
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -1233,6 +1233,9 @@ QgsAuthManager *QgsApplication::authManager()

void QgsApplication::exitQgis()
{
// make sure all threads are done before exiting
QThreadPool::globalInstance()->waitForDone();

// don't create to delete
if ( instance() )
delete instance()->mAuthManager;
Expand Down
4 changes: 0 additions & 4 deletions tests/src/python/test_qgsmaprenderer.py
Expand Up @@ -40,10 +40,6 @@ class TestQgsMapRenderer(unittest.TestCase):
def setUp(self):
pass

def tearDown(self):
# avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
QThreadPool.globalInstance().waitForDone()

def checkRendererUseCachedLabels(self, job_type):
layer = QgsVectorLayer("Point?field=fldtxt:string",
"layer1", "memory")
Expand Down
2 changes: 0 additions & 2 deletions tests/src/python/test_qgspallabeling_canvas.py
Expand Up @@ -51,8 +51,6 @@ def tearDownClass(cls):
TestQgsPalLabeling.tearDownClass()
cls.removeMapLayer(cls.layer)
cls.layer = None
# avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
QThreadPool.globalInstance().waitForDone()

def setUp(self):
"""Run before each test."""
Expand Down
2 changes: 0 additions & 2 deletions tests/src/python/test_qgspallabeling_layout.py
Expand Up @@ -95,8 +95,6 @@ def tearDownClass(cls):
TestQgsPalLabeling.tearDownClass()
cls.removeMapLayer(cls.layer)
cls.layer = None
# avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
QThreadPool.globalInstance().waitForDone()

def setUp(self):
"""Run before each test."""
Expand Down
2 changes: 0 additions & 2 deletions tests/src/python/test_qgspallabeling_placement.py
Expand Up @@ -43,8 +43,6 @@ def setUpClass(cls):
@classmethod
def tearDownClass(cls):
TestQgsPalLabeling.tearDownClass()
# avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
QThreadPool.globalInstance().waitForDone()

def setUp(self):
"""Run before each test."""
Expand Down
5 changes: 0 additions & 5 deletions tests/src/python/test_qgspointdisplacementrenderer.py
Expand Up @@ -97,11 +97,6 @@ def _tearDown(self, layer):
#QgsProject.instance().removeAllMapLayers()
QgsProject.instance().removeMapLayer(layer)

@classmethod
def tearDownClass(cls):
# avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
QThreadPool.globalInstance().waitForDone()

def _setProperties(self, r):
""" set properties for a renderer for testing with _checkProperties"""
r.setLabelAttributeName('name')
Expand Down

0 comments on commit fb832d2

Please sign in to comment.