File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -211,14 +211,22 @@ static void start_mp(safe_mode_t safe_mode) {
211
211
212
212
static void stop_mp (void ) {
213
213
#if MICROPY_VFS
214
- mp_vfs_mount_t * vfs = MP_STATE_VM (vfs_mount_table );
215
214
216
215
// Unmount all heap allocated vfs mounts.
217
- while (gc_ptr_on_heap (vfs )) {
216
+ mp_vfs_mount_t * vfs = MP_STATE_VM (vfs_mount_table );
217
+ do {
218
+ if (gc_ptr_on_heap (vfs )) {
219
+ // mp_vfs_umount will splice out an unmounted vfs from the vfs_mount_table linked list.
220
+ mp_vfs_umount (vfs -> obj );
221
+ // Start over at the beginning of the list since the first entry may have been removed.
222
+ vfs = MP_STATE_VM (vfs_mount_table );
223
+ continue ;
224
+ }
218
225
vfs = vfs -> next ;
219
- }
220
- MP_STATE_VM ( vfs_mount_table ) = vfs ;
226
+ } while ( vfs != NULL );
227
+
221
228
// The last vfs is CIRCUITPY and the root directory.
229
+ vfs = MP_STATE_VM (vfs_mount_table );
222
230
while (vfs -> next != NULL ) {
223
231
vfs = vfs -> next ;
224
232
}
You can’t perform that action at this time.
0 commit comments