Skip to content
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

SVG with map units crashes #15989

Closed
qgib opened this issue Dec 11, 2012 · 6 comments
Closed

SVG with map units crashes #15989

qgib opened this issue Dec 11, 2012 · 6 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption High Priority Symbology Related to vector layer symbology or renderers
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Dec 11, 2012

Author Name: Bernhard Ströbl (Bernhard Ströbl)
Original Redmine Issue: 6855
Affected QGIS version: master
Redmine category:symbology


To reproduce:

  1. use an svg symbol for a polygon fill
  2. set units to "Map untit"
  3. zoom in and out (mouse wheel) until QGIS crashes or hangs

tried with 1.8 on WinXP and Linux(64 bit) and master on Linux(64 bit)
tried with different svg files

@qgib
Copy link
Contributor Author

qgib commented Dec 11, 2012

Author Name: Larry Shaffer (Larry Shaffer)


I have a fix for this in a pull request with other SVG symbol fixes:

https://github.com/qgis/Quantum-GIS/pull/353/commits (commit 33e16fd)

Basically, any SVG symbol stored in the QgsSvgCache as a QImage (default for non-rotated symbols) that is larger than 790 px X 790 px X 32 bit (for transparency) exceeds current cache size. When QgsSvgCache::trimToMaximumSize() was called after storing QImages that were larger than the cache, a very funky QImage was returned, causing the crash.

Now, when a SVG symbol's size would cause it's stored QImage to exceed the maximum cache size, a QPicture is saved instead, and that is used to render the symbol. QPicture is already used when a SVG symbol is rotated (QImage method produces jagged renderings), but is slower than rendering the cached QImage.

Now you should be able to excessively zoom into the SVG. Making sure the point feature is always in the extent, I have zoomed into a SVG symbol up to 5,000,000 ^ 2 virtual pixel area. At first the symbol is a QImage, then it becomes a QPicture. This increases the memory usage significantly (jumps to ~ 2 GB on my i7 iMac when way zoomed in). There should probably be a cap to the dimensional size of a SVG QPicture that is cached, maybe 10,000 ^ 2, which would then cache a null, 0/0 or very small transparent QPicture (or skip rendering the symbol completely).


  • status_id was changed from Open to Feedback
  • fixed_version_id was configured as Version 2.0.0

@qgib
Copy link
Contributor Author

qgib commented Dec 11, 2012

Author Name: Bernhard Ströbl (Bernhard Ströbl)


Larry,

I am going to come back this issue when your pull requests have been merged. Anyways: do I understand that you would not recommend to use map units with svg symbols on low RAM (~1GB) machines (even after the fix)?

@qgib
Copy link
Contributor Author

qgib commented Dec 27, 2012

Author Name: Giovanni Manghi (@gioman)


Bernhard Ströbl wrote:

Larry,

I am going to come back this issue when your pull requests have been merged. Anyways: do I understand that you would not recommend to use map units with svg symbols on low RAM (~1GB) machines (even after the fix)?

the pull request have been committed, what is the status of this ticket?


  • operating_system was changed from any to

@qgib
Copy link
Contributor Author

qgib commented Dec 28, 2012

Author Name: Larry Shaffer (Larry Shaffer)


The fix has not been committed yet (latest pull request):

#359

That request handles both marker and fill symbols, and keeps the RAM usage to a minimum (generally 300 MB to under 1 GB with heavy-to-full cache usage), and causes no crashes (at least on Mac). The code needs reviewed by Dr. Marco, since it is a significant change to how SVG symbols gets cached, and the memory management needs proofed as well.

@qgib
Copy link
Contributor Author

qgib commented Dec 30, 2012

Author Name: Giovanni Manghi (@gioman)


  • priority_id was changed from Normal to High

@qgib
Copy link
Contributor Author

qgib commented Jan 4, 2013

Author Name: Larry Shaffer (Larry Shaffer)


Fixed in changeset "6a936b936bdbc189293c3e330da9404399034b71".


  • status_id was changed from Feedback to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Symbology Related to vector layer symbology or renderers Crash/Data Corruption labels May 24, 2019
@qgib qgib added this to the Version 2.0.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption High Priority Symbology Related to vector layer symbology or renderers
Projects
None yet
Development

No branches or pull requests

1 participant