From 26c50aa4854b08f1a694419c0149cd1d519d8b47 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 24 Apr 2013 12:03:58 +0200 Subject: [PATCH] src/driver/pictureviewer/pictureviewer.cpp: move free handlers to ~CPictureViewer(), fix segfault aufter commit d9aaafa0f1de6fc85344f2d3e057df59fd699866 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/725b3eb27ca76e4be07fb931b464f381b6e0d90e Author: Jacek Jendrzej Date: 2013-04-24 (Wed, 24 Apr 2013) Origin message was: ------------------ src/driver/pictureviewer/pictureviewer.cpp: move free handlers to ~CPictureViewer(), fix segfault aufter commit d9aaafa0f1de6fc85344f2d3e057df59fd699866 --- src/driver/pictureviewer/pictureviewer.cpp | 17 +++++++++++------ src/driver/pictureviewer/pictureviewer.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index cf1ca2b65..8c01f3ec4 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -368,6 +368,17 @@ CPictureViewer::CPictureViewer () init_handlers (); } +CPictureViewer::~CPictureViewer () +{ + Cleanup(); + CFormathandler *fh = fh_root; + while (fh) { + CFormathandler *tmp = fh->next; + free(fh); + fh = tmp; + } +} + void CPictureViewer::showBusy (int sx, int sy, int width, char r, char g, char b) { // dbout("Show Busy{\n"); @@ -446,12 +457,6 @@ void CPictureViewer::Cleanup () free (m_CurrentPic_Buffer); m_CurrentPic_Buffer = NULL; } - CFormathandler *fh = fh_root; - while (fh) { - CFormathandler *tmp = fh->next; - free(fh); - fh = tmp; - } } void CPictureViewer::getSize(const char* name, int* width, int *height) diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index 011fa8bee..bb47b34bd 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -50,7 +50,7 @@ class CPictureViewer COLOR=2 }; CPictureViewer(); - ~CPictureViewer(){Cleanup();}; + ~CPictureViewer(); bool ShowImage(const std::string & filename, bool unscaled=false); bool DecodeImage(const std::string & name, bool showBusySign=false, bool unscaled=false); bool DisplayNextImage();