diff --git a/data/OpenOS/lib/tty.lua b/data/OpenOS/lib/tty.lua index 455307b..af71ae4 100644 --- a/data/OpenOS/lib/tty.lua +++ b/data/OpenOS/lib/tty.lua @@ -221,7 +221,8 @@ function tty.keyboard() -- changes to this design should avoid this on every key hit -- this is expensive (slow!) - window.keyboard = component.invoke(screen, "getKeyboards")[1] or system_keyboard + debugprint("screen", type(screen), string.format("%q", screen)) + window.keyboard = assert(component.invoke(screen, "getKeyboards"))[1] or system_keyboard end return window.keyboard diff --git a/data/OpenOS/tmp/event.log b/data/OpenOS/tmp/event.log index 7c3134b..854ee27 100644 --- a/data/OpenOS/tmp/event.log +++ b/data/OpenOS/tmp/event.log @@ -16,3 +16,25 @@ boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') +boot/91_gpu.lua:14: attempt to call a nil value (field 'getDepth') diff --git a/src/components/gpu.c b/src/components/gpu.c index 71f9aea..c46aaf1 100644 --- a/src/components/gpu.c +++ b/src/components/gpu.c @@ -174,7 +174,7 @@ void nni_gpu_get(nni_gpu *gpu, void *_, nn_component *component, nn_computer *co void nni_gpu_getScreen(nni_gpu *gpu, void *_, nn_component *component, nn_computer *computer) { if(gpu->screenAddress == NULL) return; - nn_return_string(computer, gpu->screenAddress, 0); + nn_return_string(computer, gpu->screenAddress, strlen(gpu->screenAddress)); } void nni_gpu_maxResolution(nni_gpu *gpu, void *_, nn_component *component, nn_computer *computer) { diff --git a/src/components/screen.c b/src/components/screen.c index e80f82a..625c572 100644 --- a/src/components/screen.c +++ b/src/components/screen.c @@ -1,4 +1,5 @@ #include "screen.h" +#include #include nn_screen *nn_newScreen(nn_Alloc *alloc, int maxWidth, int maxHeight, int maxDepth, int editableColors, int paletteColors) { @@ -87,7 +88,9 @@ void nn_setAspectRatio(nn_screen *screen, int width, int height) { void nn_addKeyboard(nn_screen *screen, nn_address address) { if(screen->keyboardCount == NN_MAX_SCREEN_KEYBOARDS) return; - screen->keyboards[screen->keyboardCount++] = nn_strdup(&screen->alloc, address); + char *kb = nn_strdup(&screen->alloc, address); + if(kb == NULL) return; + screen->keyboards[screen->keyboardCount++] = kb; } void nn_removeKeyboard(nn_screen *screen, nn_address address) { diff --git a/src/computer.c b/src/computer.c index 1504063..75c5753 100644 --- a/src/computer.c +++ b/src/computer.c @@ -138,8 +138,9 @@ void nn_deleteComputer(nn_computer *computer) { computer->arch->teardown(computer, computer->archState, computer->arch->userdata); nn_deleteGuard(a, computer->lock); nn_deallocStr(a, computer->address); + nn_deallocStr(a, computer->tmpAddress); nn_dealloc(a, computer->components, sizeof(nn_component) * computer->componentCap); - nn_dealloc(a, computer->components, sizeof(nn_computer)); + nn_dealloc(a, computer, sizeof(nn_computer)); } const char *nn_pushSignal(nn_computer *computer, nn_value *values, size_t len) {