17 Dec
2007
17 Dec
'07
2:36 a.m.
I have fixed this windows-only bug, but I cannot fully understand how:
https://bugs.launchpad.net/inkscape/+bug/169011
The problem was in this line:
g_snprintf( b, len, "%s:%s;", key, css.gcharp() );
and gcharp is defined as:
gchar const *gcharp() const { return reinterpret_cast<gchar const *>(ostr.str().c_str()); }
The problem is that sometimes, rarely on some Windows systems and more frequently on others, gcharp() returned empty string for non-empty ostr. I replaced it with simply:
g_snprintf( b, len, "%s:%s;", key, css.str().c_str() );
and the problem went away.
Can anyone explain how this could happen? Is reinterpret_cast unreliable? Maybe we should eliminate it everywhere?
--
bulia byak
Inkscape. Draw Freely.
http://www.inkscape.org