[Planner Dev] Transaction bug



I've played a bit with transactions for removing resources. There is a small bug in the undo for a transaction:

static void
transaction_cmd_undo (PlannerCmd *cmd)
{
	PlannerCmd *cmd_sub;

	g_print ("Transaction undo: %s\n", cmd->name);

	while (1) {
		cmd_sub = get_undo_cmd (cmd->manager, TRUE);

		if (!cmd_sub) {
			break;
		}
		
		if (cmd_sub->undo_func) {
			cmd_sub->undo_func (cmd_sub);
		}
		
		if (cmd_sub->type == PLANNER_CMD_TYPE_BEGIN_TRANSACTION) {
			break;
		}

		g_assert (cmd_sub->type == PLANNER_CMD_TYPE_NORMAL);
	}
}

The block:

		if (cmd_sub->type == PLANNER_CMD_TYPE_BEGIN_TRANSACTION) {
			break;
		}

needs to be moved before the call to the undo function, otherwise the undo will go all the way back to the top of the undo history.

Sorry, I don't have a patch at the moment, but it is trivial to change.

Francisco





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]