diff --git a/xwords4/common/game.c b/xwords4/common/game.c index fbd795ee1..80e006943 100644 --- a/xwords4/common/game.c +++ b/xwords4/common/game.c @@ -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; diff --git a/xwords4/linux/cursesboard.c b/xwords4/linux/cursesboard.c index 7193f57f6..ef2470111 100644 --- a/xwords4/linux/cursesboard.c +++ b/xwords4/linux/cursesboard.c @@ -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; } diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index 44a11a70e..dfb43242d 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -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; }