diff --git a/libs/core/images.cpp b/libs/core/images.cpp index 63a4b924..4178122e 100644 --- a/libs/core/images.cpp +++ b/libs/core/images.cpp @@ -40,7 +40,7 @@ namespace images { //% blockId=device_build_image block="create image" //% parts="ledmatrix" Image createImage(ImageLiteral_ leds) { - return new RefMImage(imageBytes(leds)); + return NEW_GC(RefMImage, imageBytes(leds)); } /** diff --git a/libs/core/led.cpp b/libs/core/led.cpp index 88ce3e13..5eeffe75 100644 --- a/libs/core/led.cpp +++ b/libs/core/led.cpp @@ -145,7 +145,7 @@ namespace led { //% parts="ledmatrix" Image screenshot() { auto d = uBit.display.screenShot().leakData(); - auto r = new RefMImage(d); + auto r = NEW_GC(RefMImage, d); d->decr(); return r; /*