Skip to content

Commit

Permalink
Fixed deadlock in term.blit
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed Dec 21, 2019
1 parent d40cc75 commit c4b9ec8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/term.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,6 @@ int term_blit(lua_State *L) {
}
Computer * computer = get_comp(L);
TerminalWindow * term = computer->term;
std::lock_guard<std::mutex> locked_g(term->locked);
size_t str_sz, fg_sz, bg_sz;
const char * str = lua_tolstring(L, 1, &str_sz);
const char * fg = lua_tolstring(L, 2, &fg_sz);
Expand All @@ -903,6 +902,7 @@ int term_blit(lua_State *L) {
lua_pushstring(L, "Arguments must be the same length");
lua_error(L);
}
std::lock_guard<std::mutex> locked_g(term->locked);
for (unsigned i = 0; i < str_sz && term->blinkX < term->width; i++, term->blinkX++) {
if (computer->config.isColor || ((unsigned)(htoi(bg[i]) & 7) - 1) >= 6)
computer->colors = htoi(bg[i]) << 4 | (computer->colors & 0xF);
Expand Down

0 comments on commit c4b9ec8

Please sign in to comment.