Allocate RefMImage in the GC heap; fixes #1865 (#1934)

This commit is contained in:
Michał Moskal 2019-03-27 15:10:10 -07:00 committed by Peli de Halleux
parent 0f1b923cc9
commit 98bff887f5
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ namespace images {
//% blockId=device_build_image block="create image" //% blockId=device_build_image block="create image"
//% parts="ledmatrix" //% parts="ledmatrix"
Image createImage(ImageLiteral_ leds) { Image createImage(ImageLiteral_ leds) {
return new RefMImage(imageBytes(leds)); return NEW_GC(RefMImage, imageBytes(leds));
} }
/** /**

View File

@ -145,7 +145,7 @@ namespace led {
//% parts="ledmatrix" //% parts="ledmatrix"
Image screenshot() { Image screenshot() {
auto d = uBit.display.screenShot().leakData(); auto d = uBit.display.screenShot().leakData();
auto r = new RefMImage(d); auto r = NEW_GC(RefMImage, d);
d->decr(); d->decr();
return r; return r;
/* /*