[Vala] Seg Fault when using printf function



Hello,
I recently upgraded my OS to Ubuntu 17.10 from 16.04 and I think I've
discovered a bug in Vala.

This commit is now causing my application to crash:
https://github.com/steveno/balistica/commit/061a28e98f3c4468b4465e580ada78f11eec4461?diff=unified

I don't understand what changed in that commit that breaks the
application with my version of Vala versus the one I had on 16.04, but
I managed to trace it down to two lines (511 & 513) in
src/balistica_application.vala (which aren't changed in the diff !!).
If you comment out those two lines it will compile and produce the
drag calculation as expected.

I also figured out that if you change those two lines so that the
printf functions don't format more than two entries, it will also
compile and produce the expected output. With a third entry, though,
it seg faults trying to print the calculation results.

Will Seg Fault:
txtViewDragResults.buffer.text += ("Initial Velocity: %.2f ft/s Zero
Range: %.2f yards Shooting Angle: %.2f degrees\n").printf (lsln.getMv
(), lsln.getZerorange (), lsln.getAngle ()) ;

Will print as expected:
txtViewDragResults.buffer.text += ("Initial Velocity: %.2f ft/s Zero
Range: %.2f yards\n").printf (lsln.getMv (), lsln.getZerorange ()) ;

I have attached the C code that is generated.

Hopefully that wasn't to confusing. Anyone have any thoughts? Suggestions?

Steven N. Oliver

Attachment: balistica_application.c
Description: Text Data

Attachment: broken.c
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]