chiark / gitweb /
Fix grid generation crashes at Penrose 3x3 sizes. What seemed to be
authorSimon Tatham <anakin@pobox.com>
Fri, 10 May 2013 17:56:00 +0000 (17:56 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 10 May 2013 17:56:00 +0000 (17:56 +0000)
commitb6ee9debcfe46c7ed4e958511e754f150f4e9773
treec32b2c193072d563fce1a8c28900434de49e5dab
parente5df38fa152115c02938e6360fc66ae02f5251bf
Fix grid generation crashes at Penrose 3x3 sizes. What seemed to be
happening was that at the point of calling grid_make_consistent, the
grid had no faces or vertices, probably because grid_trim_vigorously
had removed them all, causing grid_make_consistent to try to allocate
a negative amount of memory and die in snewn.

Fixed by detecting this case in new_desc_penrose and retrying until
generation is successful. (It wasn't happening 100% of the time, just
_most_ of the time.) The same verification step is also used in
validate_desc_penrose in case a user manages to manually construct a
set of parameters leading to this failure mode.

[originally from svn r9840]
grid.c