← Back to team overview

kicad-developers team mailing list archive

Fixed a SIGSEGV in pcbnew

 

There is a problem in pcbnew: just creating a graphic arc gives
a sigsegv: really not fun in my book :P well, looking at the problem
even *selecting* a graphic arc should segfault...

Tracked down the issue, this is the fix:

=== modified file 'pcbnew/class_drawsegment.cpp'
--- pcbnew/class_drawsegment.cpp        2010-02-08 18:15:42 +0000
+++ pcbnew/class_drawsegment.cpp        2010-05-05 06:35:44 +0000
@@ -386,8 +386,7 @@

         case S_ARC:
             frame->AppendMsgPanel( shape, _( "Arc" ), RED );
-
-            msg.Printf( wxT( "%1." ), (float)m_Angle/10 );
+            msg.Printf( wxT( "%.1f" ), (double)m_Angle/10 );
             frame->AppendMsgPanel( _("Angle"), msg, RED );
             break;
         case S_CURVE:

Two things to notice: the first one is the invalid printf format,
probably a typo. The second, is that you can't pass a float to a vararg
function... probably there would have been an implied type promotion
during the call, but IMHO it's better to use directly the right type
(also varargs rules changed between C and C++ version...)

I do not dare to try a commit to the production repo yet, I'm still
not sufficiently fluent in bzr...


--
Lorenzo Marcantonio
Logos Srl