From ae69a754244c4e475c8d2591772ca8e005071d83 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 18 Feb 2019 11:55:41 +0100 Subject: Update to 5.42 --- hacks/glx/rubik.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'hacks/glx/rubik.c') diff --git a/hacks/glx/rubik.c b/hacks/glx/rubik.c index ed06645..e0182cf 100644 --- a/hacks/glx/rubik.c +++ b/hacks/glx/rubik.c @@ -1460,7 +1460,7 @@ rotateFace(rubikstruct * rp, int face, int direction) /* DrawSquare(face, position); */ } if (faceLoc != NULL) - (void) free((void *) faceLoc); + free(faceLoc); return True; } @@ -1728,7 +1728,7 @@ shuffle(ModeInfo * mi) for (face = 0; face < MAXFACES; face++) { if (rp->cubeLoc[face] != NULL) - (void) free((void *) rp->cubeLoc[face]); + free(rp->cubeLoc[face]); if ((rp->cubeLoc[face] = (RubikLoc *) malloc(sizeFace(rp, face) * sizeof (RubikLoc))) == NULL) { return False; @@ -1740,7 +1740,7 @@ shuffle(ModeInfo * mi) } for (i = 0; i < MAXORIENT; i++) { if (rp->rowLoc[i] != NULL) - (void) free((void *) rp->rowLoc[i]); + free(rp->rowLoc[i]); /* The following is reused so make it the biggest size */ if ((rp->rowLoc[i] = (RubikLoc *) malloc(MAXMAXSIZE * sizeof (RubikLoc))) == NULL) { @@ -1750,7 +1750,7 @@ shuffle(ModeInfo * mi) rp->storedmoves = MI_COUNT(mi); if (rp->storedmoves < 0) { if (rp->moves != NULL) - (void) free((void *) rp->moves); + free(rp->moves); rp->moves = (RubikMove *) NULL; rp->storedmoves = NRAND(-rp->storedmoves) + 1; } @@ -1880,18 +1880,23 @@ free_rubik(ModeInfo *mi) rubikstruct *rp = &rubik[MI_SCREEN(mi)]; int i; + if (!rp->glx_context) return; + glXMakeCurrent (MI_DISPLAY(mi), MI_WINDOW(mi), *rp->glx_context); + + if (rp->trackball) gltrackball_free (rp->trackball); + for (i = 0; i < MAXFACES; i++) if (rp->cubeLoc[i] != NULL) { - (void) free((void *) rp->cubeLoc[i]); + free(rp->cubeLoc[i]); rp->cubeLoc[i] = (RubikLoc *) NULL; } for (i = 0; i < MAXORIENT; i++) if (rp->rowLoc[i] != NULL) { - (void) free((void *) rp->rowLoc[i]); + free(rp->rowLoc[i]); rp->rowLoc[i] = (RubikLoc *) NULL; } if (rp->moves != NULL) { - (void) free((void *) rp->moves); + free(rp->moves); rp->moves = (RubikMove *) NULL; } } @@ -1945,7 +1950,7 @@ draw_rubik(ModeInfo * mi) return; mi->polygon_count = 0; - glXMakeCurrent(display, window, *(rp->glx_context)); + glXMakeCurrent(display, window, *rp->glx_context); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -- cgit v1.2.3-55-g7522