mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
fix double dispose in curses app
This commit is contained in:
parent
4ffaa5dd73
commit
fcf1e49c16
3 changed files with 15 additions and 13 deletions
|
@ -90,7 +90,7 @@ makeGameID( XW_UtilCtxt* XP_UNUSED_DBG(util) )
|
|||
postgres DB where INTEGER is apparently a signed 32-bit */
|
||||
gameID &= 0x7FFFFFFF;
|
||||
}
|
||||
LOG_RETURNF( "%X", gameID );
|
||||
LOG_RETURNF( "%08X", gameID );
|
||||
return gameID;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ timerChangeListener( XWEnv xwe, void* data, const XP_U32 gameID,
|
|||
{
|
||||
XWGame* game = (XWGame*)data;
|
||||
XP_ASSERT( game->util->gameInfo->gameID == gameID );
|
||||
XP_LOGF( "%s(oldVal=%d, newVal=%d, id=%d)", __func__, oldVal, newVal, gameID );
|
||||
XP_LOGFF( "(oldVal=%d, newVal=%d, id=%d)", oldVal, newVal, gameID );
|
||||
dutil_onDupTimerChanged( util_getDevUtilCtxt( game->util, xwe ), xwe,
|
||||
gameID, oldVal, newVal );
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
|
|||
destGI->allowPickTiles = srcGI->allowPickTiles;
|
||||
destGI->forceChannel = srcGI->forceChannel;
|
||||
destGI->inDuplicateMode = srcGI->inDuplicateMode;
|
||||
XP_LOGF( "%s: copied forceChannel: %d; inDuplicateMode: %d", __func__,
|
||||
XP_LOGFF( "copied forceChannel: %d; inDuplicateMode: %d",
|
||||
destGI->forceChannel, destGI->inDuplicateMode );
|
||||
|
||||
const LocalPlayer* srcPl;
|
||||
|
|
|
@ -137,7 +137,7 @@ static void relay_requestJoin_curses( void* closure, const XP_UCHAR* devID,
|
|||
|
||||
static XP_Bool rematch_and_save( CursesBoardGlobals* bGlobals, RematchOrder ro,
|
||||
XP_U32* newGameIDP );
|
||||
static void disposeBoard( CursesBoardGlobals* bGlobals );
|
||||
static void disposeBoard( CursesBoardGlobals* bGlobals, XP_Bool rmFromList );
|
||||
static void initCP( CommonGlobals* cGlobals );
|
||||
static CursesBoardGlobals* commonInit( CursesBoardState* cbState,
|
||||
sqlite3_int64 rowid,
|
||||
|
@ -237,7 +237,7 @@ cb_newFor( CursesBoardState* cbState, const NetLaunchInfo* nli,
|
|||
XP_ASSERT( 0 );
|
||||
}
|
||||
|
||||
disposeBoard( bGlobals );
|
||||
disposeBoard( bGlobals, XP_TRUE );
|
||||
}
|
||||
|
||||
const MenuList g_allMenuList[] = {
|
||||
|
@ -436,7 +436,7 @@ disposeDraw( CursesBoardGlobals* bGlobals )
|
|||
}
|
||||
|
||||
static void
|
||||
disposeBoard( CursesBoardGlobals* bGlobals )
|
||||
disposeBoard( CursesBoardGlobals* bGlobals, XP_Bool rmFromList )
|
||||
{
|
||||
XP_LOGFF( "passed bGlobals %p", bGlobals );
|
||||
/* XP_ASSERT( 0 == bGlobals->refCount ); */
|
||||
|
@ -455,10 +455,13 @@ disposeBoard( CursesBoardGlobals* bGlobals )
|
|||
|
||||
disposeUtil( cGlobals );
|
||||
|
||||
CursesBoardState* cbState = bGlobals->cbState;
|
||||
cbState->games = g_slist_remove( cbState->games, bGlobals );
|
||||
if ( rmFromList ) {
|
||||
CursesBoardState* cbState = bGlobals->cbState;
|
||||
cbState->games = g_slist_remove( cbState->games, bGlobals ); /* no!!! */
|
||||
}
|
||||
|
||||
/* onCursesBoardClosing( bGlobals->aGlobals, bGlobals ); */
|
||||
XP_LOGFF( "freeing globals: %p", bGlobals );
|
||||
g_free( bGlobals );
|
||||
}
|
||||
|
||||
|
@ -476,7 +479,7 @@ unref( CursesBoardGlobals* bGlobals )
|
|||
--bGlobals->refCount;
|
||||
XP_LOGFF( "refCount now %d", bGlobals->refCount );
|
||||
if ( 0 == bGlobals->refCount ) {
|
||||
disposeBoard( bGlobals );
|
||||
disposeBoard( bGlobals, XP_TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,7 +584,7 @@ initNoDraw( CursesBoardState* cbState, sqlite3_int64 rowid,
|
|||
if ( linuxOpenGame( cGlobals ) ) {
|
||||
result = ref( result );
|
||||
} else {
|
||||
disposeBoard( result );
|
||||
disposeBoard( result, XP_TRUE );
|
||||
result = NULL;
|
||||
}
|
||||
return result;
|
||||
|
@ -745,7 +748,7 @@ kill_board( gpointer data )
|
|||
{
|
||||
CursesBoardGlobals* bGlobals = (CursesBoardGlobals*)data;
|
||||
linuxSaveGame( &bGlobals->cGlobals );
|
||||
disposeBoard( bGlobals );
|
||||
disposeBoard( bGlobals, XP_FALSE );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1037,7 +1040,7 @@ rematch_and_save( CursesBoardGlobals* bGlobals, RematchOrder ro,
|
|||
}
|
||||
linuxSaveGame( &bGlobalsNew->cGlobals );
|
||||
}
|
||||
disposeBoard( bGlobalsNew );
|
||||
disposeBoard( bGlobalsNew, XP_TRUE );
|
||||
LOG_RETURNF( "%s", boolToStr(success) );
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -619,7 +619,6 @@ handle_quitwrite( GIOChannel* source, GIOCondition XP_UNUSED(condition), gpointe
|
|||
LOG_FUNC();
|
||||
readFromPipe( source );
|
||||
CursesAppGlobals* aGlobals = (CursesAppGlobals*)data;
|
||||
cb_closeAll( aGlobals->cbState );
|
||||
handleQuit( aGlobals, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue