From a8e2ef7cc7bcac2a2ffcf88e2887175dacae6f37 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 9 Apr 2013 19:16:05 -0700 Subject: [PATCH] set TIFFSetErrorHandler to null to start to avoid tiff from printing to stderr on fail - refs #1783 --- src/tiff_reader.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 6f723ca88..a62c42e24 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -117,11 +117,13 @@ void tiff_reader::on_error(const char* /*module*/, const char* fmt, va_list argp void tiff_reader::init() { - // TODO: error handling + TIFFSetWarningHandler(0); + // Note - we intentially set the error handling to null + // when opening the image for the first time to avoid + // leaking in TiffOpen: https://github.com/mapnik/mapnik/issues/1783 + TIFFSetErrorHandler(0); TIFF* tif = load_if_exists(file_name_); if (!tif) throw image_reader_exception( std::string("Can't load tiff file: '") + file_name_ + "'"); - - TIFFSetWarningHandler(0); TIFFSetErrorHandler(on_error); char msg[1024];