File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -254,10 +254,14 @@ void reset_displays(void) {
254254 common_hal_displayio_release_displays_impl (true);
255255 #if CIRCUITPY_OS_GETENV && CIRCUITPY_SET_DISPLAY_LIMIT
256256 // Does this need to be done or does port_free effectively do this?
257- m_del (primary_display_bus_t , display_buses_dyn , (max_allocated_display - CIRCUITPY_DISPLAY_LIMIT ));
258- m_del (primary_display_t , displays_dyn , (max_allocated_display - CIRCUITPY_DISPLAY_LIMIT ));
259- display_buses_dyn = NULL ;
260- displays_dyn = NULL ;
257+ if (max_allocated_display > CIRCUITPY_DISPLAY_LIMIT ) {
258+ // Free the dynamically allocated display buses and displays.
259+ m_del (primary_display_bus_t , display_buses_dyn , (max_allocated_display - CIRCUITPY_DISPLAY_LIMIT ));
260+ m_del (primary_display_bus_t , display_buses_dyn , (max_allocated_display - CIRCUITPY_DISPLAY_LIMIT ));
261+ m_del (primary_display_t , displays_dyn , (max_allocated_display - CIRCUITPY_DISPLAY_LIMIT ));
262+ display_buses_dyn = NULL ;
263+ displays_dyn = NULL ;
264+ }
261265 // Set dynamically allocated displays to 0 (CIRCUITPY_DISPLAY_LIMIT)
262266 max_allocated_display = CIRCUITPY_DISPLAY_LIMIT ;
263267 #endif
You can’t perform that action at this time.
0 commit comments