Skip to content

Commit 35c563d

Browse files
committed
SDL: fix debugger crash
1 parent cbf7d4d commit 35c563d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/platform/sdl/runtime.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -906,16 +906,22 @@ int debugThread(void *data) {
906906
break;
907907
case 'v':
908908
// variables
909-
net_print(socket, "Variables:\n");
910-
for (unsigned i = SYSVAR_COUNT; i < prog_varcount; i++) {
911-
if (!v_isempty(tvar[i])) {
912-
pv_writevar(tvar[i], PV_NET, socket);
913-
net_print(socket, "\n");
909+
SDL_LockMutex(g_lock);
910+
if (!runtime->isRunning()) {
911+
net_printf(socket, "\n");
912+
} else {
913+
net_print(socket, "Variables:\n");
914+
for (unsigned i = SYSVAR_COUNT; i < prog_varcount; i++) {
915+
if (!v_isempty(tvar[i])) {
916+
pv_writevar(tvar[i], PV_NET, socket);
917+
net_print(socket, "\n");
918+
}
914919
}
920+
net_print(socket, "Stack:\n");
921+
dumpStack(socket);
922+
net_print(socket, "\1");
915923
}
916-
net_print(socket, "Stack:\n");
917-
dumpStack(socket);
918-
net_print(socket, "\1");
924+
SDL_UnlockMutex(g_lock);
919925
break;
920926
case 'b':
921927
// set breakpoint

0 commit comments

Comments
 (0)