-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
QGIS crash after loading WMS layer via script and zooming in and out #44095
Comments
@pathmapper no crash here even if zooming/scrolling like crazy. 3.16 on Windows and master on Ubuntu 20.04. |
@gioman thanks for checking. I can reproduce it every time, maybe try zooming on different locations. On Windows (stacktrace above) it's a fresh Just tried it with
|
@pathmapper can you test on a new QGIS profile? |
@gioman, sure, with the new profile there is no need to zoom, QGIS crashed right after executing the script: |
let's see if others confirm. |
Tested on Ubuntu 20.04 with QGIS 3.20.0 and confirmed the crash happens without even zooming in and out |
@NyakudyaA any chance you can test master? |
I have tested on master and the issue still occurs |
…4095) Otherwise when using QgsProject::addMapLayer() from Python, the following warning is emitted: ``` Warning: QObject::connect: Cannot queue arguments of type 'QList<QgsMapLayer*>' (Make sure 'QList<QgsMapLayer*>' is registered using qRegisterMetaType().) ```
…4095) Otherwise when using QgsProject::addMapLayer() from Python, the following warning is emitted: ``` Warning: QObject::connect: Cannot queue arguments of type 'QList<QgsMapLayer*>' (Make sure 'QList<QgsMapLayer*>' is registered using qRegisterMetaType().) ```
Some warning fixes in #45254
but I wouldn't completely exclude the risk of multi-threading issues in the lines after. Actually all that code should be run in the main thread, probably using a one-time timer attached to the main thread So this is mostly a "the qgis python API is just an access to the underlying C++ world, but all the complex rules of Qt still apply, and you can easily shoot yourself in the foot" |
Just to add to @rouault 's answer -- you can make your algorithm return the "FlagNoThreading" flag to force.it to run in that main thread and avoid these issues. |
@rouault @nyalldawson thanks for explaining the backgound and the hints ! |
…4095) Otherwise when using QgsProject::addMapLayer() from Python, the following warning is emitted: ``` Warning: QObject::connect: Cannot queue arguments of type 'QList<QgsMapLayer*>' (Make sure 'QList<QgsMapLayer*>' is registered using qRegisterMetaType().) ```
Bug
QGIS crash after loading WMS layer via script and zooming in and out.
Steps to reproduce
Execute the following script via the Processing Toolbox: script_for_crash.zip
Quickly zoom in and out using the mouse scroll wheel.
Note: I'm aware that this is not the way to add a layer from a processing script but QGIS shouldn't crash anyway.
Report Details
Crash ID: 9313eccb44c59d5cc381054fb16f1e27ff672720
Stack Trace
QGIS Info
QGIS Version: 3.20.0-Odense
QGIS code revision: decaadb
Compiled against Qt: 5.15.2
Running against Qt: 5.15.2
Compiled against GDAL: 3.3.0
Running against GDAL: 3.3.0
System Info
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.18363
The text was updated successfully, but these errors were encountered: