mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
fix delete game problem: delete first using lock we already have.
This commit is contained in:
parent
3a368a8efd
commit
a90ec29ff0
2 changed files with 9 additions and 4 deletions
|
@ -1430,8 +1430,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
private void deleteAndClose()
|
private void deleteAndClose()
|
||||||
{
|
{
|
||||||
|
GameUtils.deleteGame( m_activity, m_gameLock, false );
|
||||||
waitCloseGame( false );
|
waitCloseGame( false );
|
||||||
GameUtils.deleteGame( m_activity, m_rowid, false );
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,6 +220,13 @@ public class GameUtils {
|
||||||
return rowid;
|
return rowid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void deleteGame( Context context, GameLock lock, boolean informNow )
|
||||||
|
{
|
||||||
|
tellDied( context, lock, informNow );
|
||||||
|
Utils.cancelNotification( context, (int)lock.getRowid() );
|
||||||
|
DBUtils.deleteGame( context, lock );
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean deleteGame( Context context, long rowid,
|
public static boolean deleteGame( Context context, long rowid,
|
||||||
boolean informNow )
|
boolean informNow )
|
||||||
{
|
{
|
||||||
|
@ -227,9 +234,7 @@ public class GameUtils {
|
||||||
// does this need to be synchronized?
|
// does this need to be synchronized?
|
||||||
GameLock lock = new GameLock( rowid, true );
|
GameLock lock = new GameLock( rowid, true );
|
||||||
if ( lock.tryLock() ) {
|
if ( lock.tryLock() ) {
|
||||||
tellDied( context, lock, informNow );
|
deleteGame( context, lock, informNow );
|
||||||
Utils.cancelNotification( context, (int)rowid );
|
|
||||||
DBUtils.deleteGame( context, lock );
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue