Commit 5774384b authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Modified JP2Decoder destructor to correctly finish decompressor before...

Modified JP2Decoder destructor to correctly finish decompressor before destroying the codestream. Caused segfault on OSX 11 JP2Importer unitTest and isis2std std2isis tests. References #4809.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/Fedora25@8129 41f8697f-d340-4b68-9986-7bafba869bb8
parent efe4b28a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -207,7 +207,14 @@ namespace Isis {
   */
  JP2Decoder::~JP2Decoder() {
#if ENABLEJP2K
    if(JPEG2000_Codestream) JPEG2000_Codestream->destroy();
    // See kdu_stripe_decompressor::reset documentation:
    // "You should be sure to call this function or finish before destroying the kdu_codestream
    // inteface that was passed to start."
    // i.e. Make sure to finish the decompressor before destroying the kdu_codestream.
    p_decompressor.finish();
    if(JPEG2000_Codestream) {
      JPEG2000_Codestream->destroy();
    }
    JPEG2000_Codestream = NULL;
    if(JP2_Source) {
      JP2_Source->close();
@@ -219,7 +226,6 @@ namespace Isis {
      delete JP2_Stream;
    }
    JP2_Stream = NULL;
    p_decompressor.finish();
    if(Kakadu_Error) {
      delete Kakadu_Error;
    }
+4 −0
Original line number Diff line number Diff line
@@ -90,6 +90,10 @@ namespace Isis {
   *                        unused member variable warnings in clang. Part of porting to OS X 10.11.
   *  @history 2017-08-21 Tyler Wilson, Ian Humphrey, Summer Stapleton - Added
   *                       support for new kakadu libraries.  References #4809.
   *  @history 2017-09-15 Ian Humphrey - Modified destructor to call finish() on the decompressor
   *                          before destroying the kdu_codestream. Caused segfault on OSX 10.11
   *                          for the JP2Importer test, and isis2std and std2isis jpeg2000 tests.
   *                          References #4809.
   */
  class JP2Decoder {
    public: