From c4773988d9d08593912b97f4e65d686a3e8508e2 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 12 Oct 2014 20:06:10 +0200 Subject: [PATCH] Fix segfault in wselectlist due to missing thread safety --- wselectlist.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wselectlist.cc b/wselectlist.cc index ad56e2d..7a08144 100644 --- a/wselectlist.cc +++ b/wselectlist.cc @@ -180,13 +180,14 @@ void WSelectList::drawOptionLine(char* text, int xpos, int ypos, int width, cons strncpy(buffer, text, 199); int currentColumn = taboffset; char* pointer; + char* savepointer; - pointer = strtok(buffer, "\t\n"); + pointer = strtok_r(buffer, "\t\n", &savepointer); while(pointer) { drawText(pointer, xposmod + columns[currentColumn], ypos_mod + curline * fontHeight, width - columns[currentColumn], colour); - pointer = strtok(NULL, "\t\n"); + pointer = strtok_r(NULL, "\t\n", &savepointer); if (pointer) { char delimiter = text[pointer - buffer-1]; if (delimiter == '\t') currentColumn++; -- 2.39.5