sebleedelisle / ofxLaser

An openFrameworks addon for controlling multiple lasers.
Mozilla Public License 2.0
258 stars 32 forks source link

SVG Parse errors in Release mode on Windows #29

Closed lexvandersluijs closed 2 years ago

lexvandersluijs commented 3 years ago

Hi Seb,

First of all, thanks for making this great library available, it's working really well and I'm having a lot of fun with it! Currently preparing for a small first 'production' for my local church in The Hague.

I do have a question, and just want to check if this is just on my system or if others are seeing the same thing: when I make a debug build all samples work fine. But when I do a Release build (VS 2017, Windows 10), the SVG sample is not able to parse the SVG files properly. With some of the files nothing appears, with others only a few lines that spin around.

On the console there are a few screens of messages like this:

parse failed at ".6c0-10.8-8.8-19.6-19.6-19.6H60.6C49.8 57 41 65.8 41 76.6v462.8c0 10.8 8.8 19.6 19.6 19.6H449l0 0L537 471" parse failed at ".1c0-9-6.5-26.4-27.8-26.7c-1 0-6.5 0-7.9 0c-16.2 0-27 15.1-27.2 26.2c0 0.4 0 4.1 0.1 4.6 c0.4 17.9 12.4 26.9 31.4 35.4c22.9 10.3 31.6 20.2 31.6 34.2c0 1 0 4.9 0 7c0 10-9.9 25.2-28.1 25.2c-0.2 0-7.8 0-7.9 0 c-18.2 0-27.2-16.9-27.2-26" parse failed at " M407.7 203.1c1.9 0 2.4 0 4.4 0c14.9 0 24.4 9.9 24.4 29.3c0 11.2 0 5 0 15.9c0 10.8-12.8 22.3-26.5 22.3h-36.8V138.8h35.9 c12.5 0 19.5 14.5 19.5 20.9s0 11.1 0 17.9C428.5 188.8 422.7 203.1 407.7 203.1h-34.5" parse failed at "M148.5 275.8l7.9 0c0 0 0 0 0 0c12.1 0 20.1-5.5 24.7-10 c5.9-5.9 9.6-14.1 9.6-21.2c0-1.2 0-3 0-4.5c0-1.1 0-2.1 0-2.5c0-16.8-10.6-28.7-35.2-39.8c-20.2-9.1-27.5-16.9-27.8-29.9 c0-0.4-0.1-3.9-0.1-4.3c0.2-8.2 8.4-20 21-20c0 0 0 0 0 0l2 0c2.1 0 5.1 0 5.8 0c17.7 0.3 21.6 14.8 21.6 20.4 c0 3.4 2.8 6.2 6.2 6.2s6.2-2.8 6.2-6.2c0-12.5-9.2-32.5-33.8-32.8c-0.7 0-3.8 0-6 0l-1.9 0c0 0 0 0 0 0 c-9.1 0-17.6 3.9-24.1 10.9c-5.6 6.1-9.1 14.1-9.2 21.3c0 0.6 0 4.5 0.1 4.8c0.5 21.1 14.4 31.6 35.1 40.9 c23.1 10.4 27.9 18.9 27.9 28.5c0 0.4 0 1.3 0 2.4c0 1.5 0 3.3 0 4.6c0 3-1.6 8.1-5.9 12.5c-2.9 2.9-8 6.4-15.9 6.4c0 0 0 0 0 0 l-7.9 0c-14.7 0-20.9-14.1-20.9-19.8c0-3.4-2.8-6.2-6.2-6.2s-6.2 2.8-6.2 6.2c0 6.5 3.1 14.3 8.2 20.4 C129.8 271.6 138.7 275.8 148.5 275.8z"

The error seems to occur in svgtiny, but could of course also be related to libxml2. It's very strange that this only happens in Release builds, but not Debug. I tried both Win32 and x64, and this does not make a difference. Have you maybe seen this before? Any ideas how to solve this?

BR, Lex

sebleedelisle commented 3 years ago

Hey Lex, I’ll check this out tomorrow, but in the meantime can you confirm which SVG files cause this issue?

On 28 Oct 2021, at 12:02, Lex van der Sluijs @.***> wrote:

 Hi Seb,

First of all, thanks for making this great library available, it's working really well and I'm having a lot of fun with it! Currently preparing for a small first 'production' for my local church in The Hague.

I do have a question, and just want to check if this is just on my system or if others are seeing the same thing: when I make a debug build all samples work fine. But when I do a Release build (VS 2017, Windows 10), the SVG sample is not able to parse the SVG files properly. With some of the files nothing appears, with others only a few lines that spin around.

On the console there are a few screens of messages like this:

parse failed at ".6c0-10.8-8.8-19.6-19.6-19.6H60.6C49.8 57 41 65.8 41 76.6v462.8c0 10.8 8.8 19.6 19.6 19.6H449l0 0L537 471" parse failed at ".1c0-9-6.5-26.4-27.8-26.7c-1 0-6.5 0-7.9 0c-16.2 0-27 15.1-27.2 26.2c0 0.4 0 4.1 0.1 4.6 c0.4 17.9 12.4 26.9 31.4 35.4c22.9 10.3 31.6 20.2 31.6 34.2c0 1 0 4.9 0 7c0 10-9.9 25.2-28.1 25.2c-0.2 0-7.8 0-7.9 0 c-18.2 0-27.2-16.9-27.2-26" parse failed at " M407.7 203.1c1.9 0 2.4 0 4.4 0c14.9 0 24.4 9.9 24.4 29.3c0 11.2 0 5 0 15.9c0 10.8-12.8 22.3-26.5 22.3h-36.8V138.8h35.9 c12.5 0 19.5 14.5 19.5 20.9s0 11.1 0 17.9C428.5 188.8 422.7 203.1 407.7 203.1h-34.5" parse failed at "M148.5 275.8l7.9 0c0 0 0 0 0 0c12.1 0 20.1-5.5 24.7-10 c5.9-5.9 9.6-14.1 9.6-21.2c0-1.2 0-3 0-4.5c0-1.1 0-2.1 0-2.5c0-16.8-10.6-28.7-35.2-39.8c-20.2-9.1-27.5-16.9-27.8-29.9 c0-0.4-0.1-3.9-0.1-4.3c0.2-8.2 8.4-20 21-20c0 0 0 0 0 0l2 0c2.1 0 5.1 0 5.8 0c17.7 0.3 21.6 14.8 21.6 20.4 c0 3.4 2.8 6.2 6.2 6.2s6.2-2.8 6.2-6.2c0-12.5-9.2-32.5-33.8-32.8c-0.7 0-3.8 0-6 0l-1.9 0c0 0 0 0 0 0 c-9.1 0-17.6 3.9-24.1 10.9c-5.6 6.1-9.1 14.1-9.2 21.3c0 0.6 0 4.5 0.1 4.8c0.5 21.1 14.4 31.6 35.1 40.9 c23.1 10.4 27.9 18.9 27.9 28.5c0 0.4 0 1.3 0 2.4c0 1.5 0 3.3 0 4.6c0 3-1.6 8.1-5.9 12.5c-2.9 2.9-8 6.4-15.9 6.4c0 0 0 0 0 0 l-7.9 0c-14.7 0-20.9-14.1-20.9-19.8c0-3.4-2.8-6.2-6.2-6.2s-6.2 2.8-6.2 6.2c0 6.5 3.1 14.3 8.2 20.4 C129.8 271.6 138.7 275.8 148.5 275.8z"

The error seems to occur in svgtiny, but could of course also be related to libxml2. It's very strange that this only happens in Release builds, but not Debug. I tried both Win32 and x64, and this does not make a difference. Have you maybe seen this before? Any ideas how to solve this?

BR, Lex

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

lexvandersluijs commented 3 years ago

I think I've narrowed the problem down a bit. I took the first set of characters from the error message ".6c0-10.8-8" and found that these are from this path declaration in "2_seblee.svg":

<path fill="none" stroke="#FF00FF" stroke-width="9.9213" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M537,471V76.6c0-10.8-8.8-19.6-19.6-19.6H60.6C49.8,57,41,65.8,41,76.6v462.8c0,10.8,8.8,19.6,19.6,19.6H449l0,0L537,471"/>

which seemed to indicate that the code stopped parsing "V76.6" at the dot, which means that the next token would start at a dot, which then breaks because this isn't supposed to happen.

So I switched the number-format settings on my system from Dutch to English/US and behold, all files are parsed correctly now!

But what on earth could cause the parsing settings to work in Debug mode but not in Release mode? To be sure: this is probably unrelated to ofxLaser, but it would be cool to solve this so that others don't run into the same thing.

By the way, the source code for my project is at: https://github.com/lexvandersluijs/clc_laser/tree/main/of_v0.11.2_vs2017/apps/CLC-LC .

Let me know if you want to try it, a tiny change to ofxLaser is required to make it work. Basically:

My application will set the boolean to true so that it can do its own UI things before the call to render() is made.