Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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:
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.
Posted 10-May-13 1:28am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Memory may be corrupt due to another routine in your program. Look at code that is executed before _GetGraphicSurface() is invoked.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
perhaps you should compile your project with warning level /W3 at least.
 
My experience is that a higher warning level and of course the elimination
of these warnings will give you a more stable exe even as release version.
 
Best regards
  Permalink  
Comments
H.Brydon at 14-May-13 0:50am
   
Agreed except I would suggest /W4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

A simple way to see if the stack is being overwritten, move these variables that get these mysterious values above the declaration of jMPGFPlaylist variable and see if the next value is overwritten.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 295
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 George Jonsson 170
0 OriginalGriff 5,415
1 DamithSL 4,422
2 Maciej Los 3,820
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,911


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 11 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100