Skip to content
Snippets Groups Projects
Commit 0992e75d authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix Win32 console (and likely curses) crash on connect

RIP initialization was trying to obtain a lock that only exists when
using a bitmap console.  Don't allow RIP to be enabled, and don't
perform the operations that require the lock when the CONIO_OPT_SET_PIXEL
ciolib option is not set.
parent eae79b12
No related branches found
No related tags found
No related merge requests found
...@@ -15585,7 +15585,7 @@ handle_rip_line(BYTE *buf, unsigned *blen, unsigned *pos, size_t *rip_start, uns ...@@ -15585,7 +15585,7 @@ handle_rip_line(BYTE *buf, unsigned *blen, unsigned *pos, size_t *rip_start, uns
} }
else if (strcmp(pending, "\x1b[2!") == 0) { else if (strcmp(pending, "\x1b[2!") == 0) {
gettextinfo(&ti); gettextinfo(&ti);
if (rip.version) if (rip.version && (cio_api.options & CONIO_OPT_SET_PIXEL))
rip.enabled = true; rip.enabled = true;
} }
else if ((pending[0] == '\x1b') && (pending[1] == '[')) { else if ((pending[0] == '\x1b') && (pending[1] == '[')) {
...@@ -16051,7 +16051,7 @@ init_rip(struct bbslist *bbs) ...@@ -16051,7 +16051,7 @@ init_rip(struct bbslist *bbs)
memset(&rip, 0, sizeof(rip)); memset(&rip, 0, sizeof(rip));
rip.state = RIP_STATE_BOL; rip.state = RIP_STATE_BOL;
rip.newstate = RIP_STATE_FLUSHING; rip.newstate = RIP_STATE_FLUSHING;
rip.enabled = bbs->rip != RIP_VERSION_NONE; rip.enabled = (bbs->rip != RIP_VERSION_NONE) && (cio_api.options & CONIO_OPT_SET_PIXEL);
rip.version = bbs->rip; rip.version = bbs->rip;
rip.x = 0; rip.x = 0;
rip.y = 0; rip.y = 0;
...@@ -16067,6 +16067,7 @@ init_rip(struct bbslist *bbs) ...@@ -16067,6 +16067,7 @@ init_rip(struct bbslist *bbs)
rip.line_pattern = 0xffff; rip.line_pattern = 0xffff;
rip.line_width = 1; rip.line_width = 1;
rip.x_dim = 640; rip.x_dim = 640;
if (cio_api.options & CONIO_OPT_SET_PIXEL) {
pthread_mutex_lock(&vstatlock); pthread_mutex_lock(&vstatlock);
rip.x_max = vstat.scrnwidth; rip.x_max = vstat.scrnwidth;
if (rip.x_max > rip.x_dim) if (rip.x_max > rip.x_dim)
...@@ -16076,6 +16077,7 @@ init_rip(struct bbslist *bbs) ...@@ -16076,6 +16077,7 @@ init_rip(struct bbslist *bbs)
if (rip.y_max > rip.y_dim) if (rip.y_max > rip.y_dim)
rip.y_max = rip.y_dim; rip.y_max = rip.y_dim;
pthread_mutex_unlock(&vstatlock); pthread_mutex_unlock(&vstatlock);
}
rip.viewport.ex = rip.x_dim - 1; rip.viewport.ex = rip.x_dim - 1;
rip.viewport.ey = rip.y_dim - 1; rip.viewport.ey = rip.y_dim - 1;
rip.bbs = bbs; rip.bbs = bbs;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment