Ensure the rencache commands buffer is cleared on restart
Fix issue #176 but it should be tested more thoroughly.
This commit is contained in:
parent
820d520fc3
commit
d8244120e9
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <SDL.h>
|
||||
#include "api/api.h"
|
||||
#include "rencache.h"
|
||||
#include "renderer.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -158,6 +159,11 @@ init_lua:
|
|||
enable_momentum_scroll();
|
||||
#endif
|
||||
|
||||
/* We need to clear the rencache commands because we may restarting the application
|
||||
and it could be non-empty. It is important to clear the command buffer because it
|
||||
stores pointers to font_desc objects and these are Lua managed. */
|
||||
rencache_clear();
|
||||
|
||||
const char *init_lite_code = \
|
||||
"local core\n"
|
||||
"xpcall(function()\n"
|
||||
|
|
|
@ -312,3 +312,7 @@ void rencache_end_frame(void) {
|
|||
cells_prev = tmp;
|
||||
command_buf_idx = 0;
|
||||
}
|
||||
|
||||
void rencache_clear() {
|
||||
command_buf_idx = 0;
|
||||
}
|
||||
|
|
|
@ -13,5 +13,6 @@ int rencache_draw_text(FontDesc *font_desc, const char *text, int x, int y, Ren
|
|||
void rencache_invalidate(void);
|
||||
void rencache_begin_frame(void);
|
||||
void rencache_end_frame(void);
|
||||
void rencache_clear();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue