Skip to content

Commit b9890f2

Browse files
authored
Merge pull request #3497 from jepler/issue3473
sharpdisplay: Fix memory corruption across soft-reset
2 parents 2ad54f8 + d7c3f81 commit b9890f2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

shared-module/sharpdisplay/SharpMemoryFramebuffer.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ bool common_hal_sharpdisplay_framebuffer_get_pixels_in_byte_share_row(sharpdispl
9090
}
9191

9292
void common_hal_sharpdisplay_framebuffer_reset(sharpdisplay_framebuffer_obj_t *self) {
93-
if (!allocation_from_ptr(self->bufinfo.buf)) {
94-
self->bufinfo.buf = NULL;
95-
}
96-
9793
if (self->bus != &self->inline_bus
9894
#if BOARD_SPI
9995
&& self->bus != common_hal_board_get_spi()
@@ -105,7 +101,9 @@ void common_hal_sharpdisplay_framebuffer_reset(sharpdisplay_framebuffer_obj_t *s
105101
}
106102

107103
void common_hal_sharpdisplay_framebuffer_reconstruct(sharpdisplay_framebuffer_obj_t *self) {
108-
104+
if (!allocation_from_ptr(self->bufinfo.buf)) {
105+
self->bufinfo.buf = NULL;
106+
}
109107
}
110108

111109
void common_hal_sharpdisplay_framebuffer_get_bufinfo(sharpdisplay_framebuffer_obj_t *self, mp_buffer_info_t *bufinfo) {

0 commit comments

Comments
 (0)