set TIFFSetErrorHandler to null to start to avoid tiff from printing to stderr on fail - refs #1783

This commit is contained in:
Dane Springmeyer 2013-04-09 19:16:05 -07:00
parent 72a453efc0
commit a8e2ef7cc7

View File

@ -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];