Skip to content

Commit

Permalink
fix(demo mode): Deinit demo mode when main init is aborted (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slider0007 authored Jan 10, 2025
1 parent 232509d commit bbc15a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions code/components/camera_ctrl/ClassControlCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,14 +1142,12 @@ bool ClassControlCamera::loadNextDemoImage(camera_fb_t *_fb)
/* Free only user allocated memory without deinit of cam driver */
void ClassControlCamera::freeDemoMemoryOnly()
{
demoFiles.clear();
std::vector<std::string>().swap(demoFiles); // Ensure that memory allocated by vector gets freed
disableDemoMode();
}


ClassControlCamera::~ClassControlCamera()
{
disableDemoMode();
deinitCam();
demoFiles.clear();
std::vector<std::string>().swap(demoFiles); // Ensure that memory allocated by vector gets freed
}
1 change: 1 addition & 0 deletions code/components/mainprocess_ctrl/ClassFlowTakeImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,5 @@ time_t ClassFlowTakeImage::getTimeImageTaken()
ClassFlowTakeImage::~ClassFlowTakeImage()
{
delete rawImage;
cameraCtrl.freeDemoMemoryOnly();
}

0 comments on commit bbc15a0

Please sign in to comment.