-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QgsSvgCache fetches remote SVG files in a background task
Previously QgsSvgCache would often try to fetch remote images using a network request on the main thread, by calling processEvents repeatedly until the request was complete. This caused lots of bugs, since the main thread processEvents would proceed with all kinds of stuff assuming that the svg fetch operation was complete, leading to frequent crashes and deadlocks and making remote svg use impossible (it's likely that the SVG cache remote fetching code was written in the pre-multi-threaded rendering era). There's no way to fix this with async svg fetching - we HAVE to remove the processEvents call, and a QEventLoop won't help either (since the method may be called on the main thread). Accordingly the only solution is to fetch the requested svg in the background, and return a temporary "downloading" svg for use in the meantime. We use a QgsNetworkContentFetcherTask to do this, so it's nicely integrated with task manager. A request task is fired up when a remote svg is requested for the first time, with the temporary downloading svg returned for use by the caller asynchronously. QgsSvgCache then emits the remoteSvgFetched signal when a previously requested remote SVG has been successfully fetched, triggering a map canvas redraw with the correct SVG graphic. Fixes #18504
- Loading branch information
1 parent
3dec175
commit 45c400c
Showing
6 changed files
with
113 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters