[FIXED in v7.1] Delete JPEG decoder crashes in Debug mode

[FIXED in v7.1] Delete JPEG decoder crashes in Debug mode

Bild des Benutzers Sean V.

Hello there,

We've been using Intel IPP since version 6.0 and since then we've been noticing problems with UIC libs. We use all the UIC codecs in our application and we found out that deleting the jpeg object in Debug mode causes the application to crash. In Release mode it works with no problems. We initialize  UIC::BaseImageDecoder* dec = NULL; and then depending on the file type we construct appropriate decoder with dec = new JPEGDecoder() (or others).

After we finish working with it, we tried calling dec->Close() and then deleting dec, but it crashed with no stack trace on delete dec. Any help is welcome.

This is all happening with dynamically linked UIC libs version 7.0.7.

Thanks a lot.

12 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Sergey Kostrov

Let's consider a pseudo-code:
...
class JPEGDecoder
{
public:
JPEGDecoder()
{
...
};

~JPEGDecoder() <= set a break point here
{
...
};
...
};
...
void main( void )
{
JPEGDecoder *dec = new JPEGDecoder();
...
if( dec != NULL )
{
dec->Close();
delete dec; // Here it crashes, right?
}
...
}

When you're debugging try to step into delete C++ operator or set a break point in JPEGDecoder::~JPEGDecoder destructor in order to see what is going on there. I could assume that some resource is de-allocated twice.

Bild des Benutzers manca1

Hello,

I can't stop in source of JPEGDecoder because I am using prebuilt libraries and UIC dlls. Can you try to reproduce the bug yourself?

Thanks.

Bild des Benutzers manca1

Anyone?

Bild des Benutzers Sergey Khlystov (Intel)

Hi,

Do not use Close() here. ~JPEGDecoder calls Close() itself and there is double "delete m_jpeg".
This is fixed in 7.1.

Regards,
Sergey 

Bild des Benutzers Sergey Kostrov

>>...Do not use Close() here. ~JPEGDecoder calls Close() itself and there is double "delete m_jpeg". This is fixed in 7.1.

Thanks for the confirmation that some issues are fixed.

Bild des Benutzers manca1

Even without Close(), it still crashes.

Bild des Benutzers Sergey Kostrov

>>...Even without Close(), it still crashes...

Please take a look. This is your statement:

>>...This is all happening with dynamically linked UIC libs version 7.0.7...

This is Sergey Khlystov (Intel) statement:

>>...This is fixed in 7.1...

So, my question is did you upgrade the IPP library to version 7.1?

Bild des Benutzers manca1

This is what you said:

"Do not use Close() here. ~JPEGDecoder calls Close() itself and there is double "delete m_jpeg". 
This is fixed in 7.1."

I understood that Close() calls delete m_jpeg and then since destructor calls Close() again it deletes already deleted pointer. Now, I tried removing Close() and leaving destructor calls it and the application still crashes. Did you mean to say that destructor calls delete m_jpeg as well as Close(). Meaning you had a big bug in your code. I'll try 7.1 and see if it works.

Thanks.

Bild des Benutzers Sergey Kostrov

>>... I'll try 7.1 and see if it works.

Please try it. Here is a generic explanation of why it happens:

[ A version with a Bug ]
...
JPEGDecoder::~JPEGDecoder()
{
Close();
};

JPEGDecoder::Close()
{
DeallocateResource( pSomePointer );
};
...

[ A Correct version ]
...
JPEGDecoder::~JPEGDecoder()
{
Close();
};

JPEGDecoder::Close()
{
if( pSomePointer != NULL )
{
DeallocateResource( m_pSomePointer );
m_pSomePointer = NULL;
}
};
...
Note: In that case a "double" deallocation of some resource in m_pSomePointer simply impossible and such errors / bugs are very common.

Bild des Benutzers manca1

Works with IPP 7.1. Thank you.

Bild des Benutzers Sergey Kostrov

>>Works with IPP 7.1. Thank you.

Thanks for the confirmation. You could also chage the title of the thread to [ FIXED in v7.1 ] Delete JPEG decoder crashes in Debug mode.

Melden Sie sich an, um einen Kommentar zu hinterlassen.