-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
valgrind: fixed a few memory leaks and errors #2724
Conversation
Hi Patrick -1 for removing private NetworkAccessManager instances - they were introduced because QNAM class is not thread safe and so using that one singleton from multiple threads causes havoc. |
Hi @wonder-sk if ( QgsNetworkAccessManager::instance()->thread() != thread() ) {
abort();
} QGIS crashed in flames. And, after looking I do have those messages in the logs:
So I'm reverting my changes about that. But what about the other providers that happily use the singleton? Just for fun, I've changed the implementation of QgsNetworkAccessManager* QgsNetworkAccessManager::instance()
{
static QgsNetworkAccessManager* sInstance( new QgsNetworkAccessManager( QApplication::instance() ) );
if ( sInstance->thread() != QThread::currentThread() ) {
abort();
}
return sInstance;
} QGIS master (82c9a5a) crashes in flames there:
I think I'll create an issue. What is your opinion? |
WMS and WCS should be handled correctly (at least the rendering part). WFS is buggy in various ways and a significant rewrite is planned: qgis/QGIS-Enhancement-Proposals#53
Sounds good. I can even see an easy way to demonstrate the issue: define few WMS servers, then expand them in the browser dock widget. Restart QGIS: on start, WMS server items will be populated (in threads) because they have expanded state and so they request capabilities of WMS servers - at that point the whole QGIS gets stuck while requesting capabilities. |
I would replace
with
so this only kicks in on debug builds |
I have no intention of adding this test to my commit. It crashes all the time. I've create an issue for the problem: https://hub.qgis.org/issues/14192 |
Ok, makes sense. Would be great to put this assertion in there once the underlying issues are fixed to avoid future regressions. |
Am I wrong, or this was fixed with 2eb8243? |
@alexbruy, partially, yes. There are other fixes. I'll go through them and I'll update this PR when I have some time. |
The reply handling around QgsNetworkAccessManager is quite complex and there was a few cases where the reply was not deleted. A leak in the QgsDataItemProviderRegistry. A lack of validation during snapping configuration loading.
@m-kuhn, this PR has been revisited, please remove the |
@@ -615,7 +615,7 @@ void QgsSnappingUtils::readConfigFromProject() | |||
layerIdList.size() != snapToList.size() ) | |||
return; | |||
|
|||
if ( !snappingDefinedInProject ) | |||
if ( layerIdList.isEmpty() || !snappingDefinedInProject || !ok ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wonder-sk does this look good to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see any harm here, but I fail to understand what does that change fix...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- parsing errors in the settings were just ignored.
- I don't really remember... old PR. I guess to leave the snapMode to SnapCurrentLayer.
Cleaning up my PR that have been there for too long. |
@pvalsecc is any of this still relevant? |
@nyalldawson. I don't know, I don't have crashes because of that and I've spent too much time rebasing this guy already. I'm just cutting my losses... ;-) |
The reply handling around QgsNetworkAccessManager is quite complex and
there was a few cases where the reply was not deleted.
In the WMS provider, the usage of QgsNetworkAccessManager was a bit weird.
It's not a good idea to create and delete it that often when there is a
singleton around.