Fixed memory leaks at linux emulator shutdown
This commit is contained in:
parent
5f40ceceb3
commit
28929aab90
|
|
@ -32,7 +32,7 @@
|
|||
#include <string.h>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
void *frameBuffer; /* Pointer to framebuffer */
|
||||
void *frameBuffer = NULL; /* Pointer to framebuffer */
|
||||
bool inProgress; /* Flag to signal when rendering is in progress */
|
||||
|
||||
/*
|
||||
|
|
@ -73,6 +73,7 @@ uint32_t fetchPixelFromFb(unsigned int x, unsigned int y)
|
|||
|
||||
pixel = 0xFF000000 | (px << 16) | (px << 8) | px;
|
||||
#endif
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
|
|
@ -114,12 +115,11 @@ void display_init()
|
|||
|
||||
void display_terminate()
|
||||
{
|
||||
while (inProgress)
|
||||
{} /* Wait until current render finishes */
|
||||
printf("Terminating SDL display emulator, goodbye!\n");
|
||||
free(frameBuffer);
|
||||
while (inProgress){ } /* Wait until current render finishes */
|
||||
chan_close(&fb_sync);
|
||||
chan_terminate(&fb_sync);
|
||||
if(frameBuffer != NULL) free(frameBuffer);
|
||||
frameBuffer = NULL;
|
||||
}
|
||||
|
||||
void display_renderRows(uint8_t startRow, uint8_t endRow)
|
||||
|
|
|
|||
|
|
@ -375,6 +375,10 @@ void sdlEngine_run()
|
|||
}
|
||||
}
|
||||
|
||||
printf("Terminating SDL display emulator, goodbye!\n");
|
||||
|
||||
SDL_DestroyTexture(displayTexture);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ void platform_init()
|
|||
void platform_terminate()
|
||||
{
|
||||
printf("Platform terminate\n");
|
||||
gfx_terminate();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue