Click here to Skip to main content
15,886,724 members

Exe runs properly in debug and crash in release

Vaibhav_J_Jaiswal asked:

Open original thread
Hi friends,

I am fetching a problem in which debug exe is runs properly and in release it crashed. I debug the exe in release mode and got the following things.
First I show you code:
C++
void CPlaybackThread::_GetGraphicSurface(uint64_t        in_ui64Time,
                                         TAPIMvSurface & out_rjSurface, int iLogoIndex)
{
	HRESULT		 hr				= MV_E_FAIL;
	unsigned long	 ulCount			= 1;
	double		 dStreamTime			= 0;
	uint64_t	 ui64PlayStreamTime		= 0;
	uint64_t	 ui64MgfFrameCount		= 0;
	TAPIMvFlexReader pJMgfPlayListReader	        = NULL;
	TAPIMvPlayList	 pJMGFPlayList			= NULL;
	TAPIMvSurface    pJLastReadMgfFrame		= NULL; 
	TAPIMvAVContent  pJLastReadMgfFrameSynch        = NULL; 
	TAPIMvSurface    pJReadMgfFrame			= NULL; 

	SMvSurfaceDescription sGraphicDesc = {sizeof(SMvSurfaceDescription)};
	CPlaybackContext &playbackContext = m_pPlaybackDlg->GetPlaybackContext (m_ulCurrentReaderIndex);

	ui64PlayStreamTime	= playbackContext.GetPlayStreamTime();
	pJMGFPlayList		= playbackContext.GetMGFPlaylist(iLogoIndex);
	pJMgfPlayListReader	= playbackContext.GetMGFReader(iLogoIndex);
	ui64MgfFrameCount	= pJMGFPlayList->GetDuration();
	
   if (ui64PlayStreamTime < ui64MgfFrameCount)
   {   
		hr = pJMgfPlayListReader -> GetBuffer (&pJReadMgfFrame, &ulCount, NULL, NULL, NULL, NULL, NULL, &dStreamTime, in_ui64Time, true);
		ASSERT(SUCCEEDED(hr));
   }

   if (SUCCEEDED(hr))
   {
      if (pJLastReadMgfFrame != NULL)
      {
         hr = pJLastReadMgfFrameSynch->SignalReadCompletion();
         ASSERT(SUCCEEDED(hr));

         pJLastReadMgfFrame      = NULL;
         pJLastReadMgfFrameSynch = NULL;
      }

      if (ulCount == 1 || ulCount == 2)
      {
		  out_rjSurface = pJReadMgfFrame;

         // We have the buffer.  Release the old one
         if (pJLastReadMgfFrame != NULL)
         {
            hr = pJLastReadMgfFrameSynch->SignalReadCompletion();
            ASSERT(SUCCEEDED(hr));

            pJLastReadMgfFrame      = NULL;
            pJLastReadMgfFrameSynch = NULL;
         }

         hr = out_rjSurface->GetSurfaceDescription(&sGraphicDesc);
         ASSERT(SUCCEEDED(hr));
		 
         hr = out_rjSurface->ChangeDestinationPosition(&sPosition[iLogoIndex]);
         ASSERT(SUCCEEDED(hr));

         return;
      }
   }
}


In the above code the variable 'pJLastReadMgfFrame' is initially null, but while debugging in release without initializing this variable with any other value I got this value as not null.
From where it gets the value i am not getting. And in condition 'if (pJLastReadMgfFrame != NULL)' it enters and crashed on statement 'hr = pJLastReadMgfFrameSynch -> SignalReadCompletion ();'

Can any body help me to resolve this problem.
Tags: C++, VC++ (Visual C++ 6.0), Debugging, Release

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900