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.)
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.)