Skip to content

Commit a9c7fd5

Browse files
committed
Fix the crash in b3dMainLoop when "If the edge is not on top toggle its (back) fills".
This fixes several crashes with cases submitted by Stéphane Rolindin. Thanks, Stéph!
1 parent 83e43ee commit a9c7fd5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

platforms/Cross/plugins/Squeak3D/b3dMain.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,14 +1393,19 @@ int b3dMainLoop(B3DRasterizerState *state, int stopReason)
13931393
}
13941394
/*-- end of search for next top edge --*/
13951395

1396-
/*-- Now do the drawing from leftEdge to rightEdge --*/
1397-
#if 1 /* This assert fails in rare cases; the fix is not understood. eem */
1396+
/* If the "edge is not on top toggle its (back) fills" guard
1397+
* above nilled rightEdge then presumably we're done. So
1398+
* arrange that we quit the main loop (see BEGIN MAINLOOP at
1399+
* about line 1227 above). eem 2019/12/29
1400+
*/
1401+
if (!rightEdge) {
1402+
aet->size = 0;
1403+
b3dCleanupFill(fillList);
1404+
break;
1405+
}
13981406
assert(leftEdge && rightEdge);
1399-
#else
1400-
if(!leftEdge || !rightEdge)
1401-
FAIL_UPDATING(B3D_NO_MORE_EDGES); // another segfault
1402-
//FAIL_PAINTING(B3D_NO_MORE_EDGES); // blow up in allocating edges
1403-
#endif
1407+
1408+
/*-- Now do the drawing from leftEdge to rightEdge --*/
14041409
if(fillList->firstFace) {
14051410
/* Note: We fill *including* leftX and rightX */
14061411
int leftX = (leftEdge->xValue >> B3D_FixedToIntShift) + 1;

0 commit comments

Comments
 (0)