News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Crash when using with SVG files

Started by Miguel Gimenez, October 01, 2022, 09:40:21 AM

Previous topic - Next topic

Miguel Gimenez

I am adapting the code to HiDPI after wx3.1.6 using wxBitmapBundle (see ticket #1297 for details), and I have discovered that wxBitmapBundle::FromSVG() method produces random crashes because the underlying library (nanoSVG) is buggy:
  - first crash is in nsvg_Parse(). This only happens on non-english locales, is fixed in nanoSVG trunk but not in wxWidgets, and a workaround is locale switching before calling FromSVG().
  - second crash is in nsvg__addEdge(). AFAIK this is not fixed and there is no workaround.

Because of this, I will temporarily remove calls to wxBitmapBundle::FromSVG() along this weekend.

AndrewCot

Straight up: I am not happy with the process used and the way the SVN changes have been made.
Going forward:
Can a new interface be added so that the changes in the vast majority of code calls one function/class and this class/function has the smarts to either use the existing PNG or the new SVG files. This has the advantage on only modifying the existing code:

       
  • Once
  • Allows for the removal of the PNG support without changing the C::B source files
  • updates as needed without modifying the existing C::B code after the initial change.
  • Existing C::B code does not have any #if..#else..#endif block

gd_on

In my own software, I use wxBitmapBundle::FromSVGFile() in wxWidgets 3.2.1 and never met such problems (until now ???)
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Miguel Gimenez

It was a misunderstanfing on my side, it is fixed now.

ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.