Re-added code to free allocated video memory at application close. Free Qt NES wrapper memory at application close.

This commit is contained in:
mjbudd77 2021-02-21 10:39:21 -05:00
parent b8e647fbc6
commit 2a2e1b7bca
6 changed files with 38 additions and 17 deletions

View File

@ -866,6 +866,13 @@ int fceuWrapperClose( void )
return 0;
}
int fceuWrapperMemoryCleanup(void)
{
close_nes_shm();
return 0;
}
/**
* Update the video, audio, and input subsystems with the provided
* video (XBuf) and audio (Buffer) information.

View File

@ -28,6 +28,7 @@ int CloseGame(void);
int reloadLastGame(void);
int fceuWrapperInit( int argc, char *argv[] );
int fceuWrapperMemoryCleanup( void );
int fceuWrapperClose( void );
int fceuWrapperUpdate( void );
void fceuWrapperLock(void);

View File

@ -119,6 +119,8 @@ int main( int argc, char *argv[] )
delete consoleWindow;
fceuWrapperMemoryCleanup();
return retval;
}

View File

@ -44,3 +44,12 @@ nes_shm_t *open_nes_shm(void)
return vaddr;
}
//************************************************************************
void close_nes_shm(void)
{
if ( nes_shm )
{
free(nes_shm); nes_shm = NULL;
}
}
//************************************************************************

View File

@ -89,4 +89,6 @@ extern nes_shm_t *nes_shm;
nes_shm_t *open_nes_shm(void);
void close_nes_shm(void);
#endif

View File

@ -87,23 +87,23 @@ std::string FCEUI_GetSnapshotAsName() { return AsSnapshotName; }
void FCEU_KillVirtualVideo(void)
{
//mbg merge TODO 7/17/06 temporarily removed
//if(xbsave)
//{
// free(xbsave);
// xbsave=0;
//}
//if(XBuf)
//{
//UnmapViewOfFile(XBuf);
//CloseHandle(mapXBuf);
//mapXBuf=NULL;
//}
//if(XBackBuf)
//{
// free(XBackBuf);
// XBackBuf=0;
//}
if ( XBuf )
{
FCEU_free(XBuf); XBuf = NULL;
}
if ( XBackBuf )
{
FCEU_free(XBackBuf); XBackBuf = NULL;
}
if ( XDBuf )
{
FCEU_free(XDBuf); XDBuf = NULL;
}
if ( XDBackBuf )
{
FCEU_free(XDBackBuf); XDBackBuf = NULL;
}
//printf("Video Core Cleanup\n");
}
/**