spillerrec / imgviewer

Customizable image viewer with minimalistic interface
2 stars 1 forks source link

longjmp issues in PNG reader #41

Closed spillerrec closed 9 years ago

spillerrec commented 9 years ago

libpng uses longjmp for exceptions, but it does not call destructors. There are several memory leaks due to this, especially with QImage objects. Getting it right would require us to allocate everything beforehand, which will be rather tricky. I also question the extra setjmp call in readRGBA() which seems a bit unnecessary. We should also wrap png_ptr and png_info in a RAII wrapper to simplify it a bit. (The destructor is safe, as it needs to be called after we stop using libpng anyway.)