Skip to content

Commit e1d6879

Browse files
author
Benjamin Délèze
authored
Merge pull request #6037 from cyberbotics/sync-master-c68b8b62c
Merge master into develop
2 parents 5b0958f + 3f84b12 commit e1d6879

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/reference/changelog-r2023.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Released on ??
2828
- Improved handling of non-ASCII robot names and possible crashes resulting from long names ([#5959](https://github.com/cyberbotics/webots/pull/5959)).
2929
- Change the Windows version of SUMO to 1.13 to match the one used on Linux and MacOS and avoid a potiental Log4J vulnerability ([#6010](https://github.com/cyberbotics/webots/pull/6010)).
3030
- Bug Fixes
31+
- Fixed the clean-up of the motion API which was firing warnings in Python ([#6029](https://github.com/cyberbotics/webots/pull/6029)).
3132
- Fixed the behavior of the [Connector](connector.md) after a reset to return to the controller the correct status ([#5889](https://github.com/cyberbotics/webots/pull/5889))
3233
- Fixed redirection of stdout/stderr for Python controllers on Windows ([#5807](https://github.com/cyberbotics/webots/pull/5807)).
3334
- Fixed crash in Python API when a robot controller was using several cameras with different resolutions ([#5705](https://github.com/cyberbotics/webots/pull/5705)).

src/controller/c/motion.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static const double UNDEFINED_POSITION = -9999999.9;
5050
static WbMotionRef head = NULL;
5151
static const char *HEADER = "#WEBOTS_MOTION";
5252
static const char *VERSION = "V1.0";
53+
static int cleanup_done = 0;
5354

5455
// string to time conversion
5556
// acceptable input format: [[Minutes:]Seconds:]:Milliseconds
@@ -382,6 +383,7 @@ void motion_cleanup() {
382383
wbu_motion_delete(head);
383384

384385
ROBOT_ASSERT(head == NULL);
386+
cleanup_done = 1;
385387
}
386388

387389
// Webots API functions below
@@ -451,10 +453,12 @@ WbMotionRef wbu_motion_new(const char *filename) {
451453
void wbu_motion_delete(WbMotionRef motion) {
452454
if (!motion)
453455
return;
454-
455456
// dequeue self
456457
if (!motion_dequeue(motion)) {
457-
fprintf(stderr, "Error: %s(): attempt to delete an invalid 'motion'.\n", __FUNCTION__);
458+
if (cleanup_done) { // the Python API calls first motion_cleanup and then tries to delete motion files.
459+
ROBOT_ASSERT(head == NULL); // no new motion should have been created after the cleanup.
460+
} else
461+
fprintf(stderr, "Error: %s(): attempt to delete an invalid 'motion'.\n", __FUNCTION__);
458462
return;
459463
}
460464

0 commit comments

Comments
 (0)