Skip to content

Commit

Permalink
pk-transaction: Check that Finished signal is emitted at most once
Browse files Browse the repository at this point in the history
While I haven’t seen it being emitted more than once, the transaction
code is quite complex, and it would make things more robust to add a
check to verify this.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
  • Loading branch information
pwithnall authored and ximion committed May 29, 2023
1 parent 44215db commit 64278c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pk-transaction.c
Expand Up @@ -90,6 +90,7 @@ struct PkTransactionPrivate
guint speed;
guint download_size_remaining;
gboolean finished;
gboolean emitted_finished;
gboolean allow_cancel;
gboolean waiting_for_auth;
gboolean emit_eula_required;
Expand Down Expand Up @@ -510,6 +511,9 @@ pk_transaction_finished_emit (PkTransaction *transaction,
PkExitEnum exit_enum,
guint time_ms)
{
g_assert (!transaction->priv->emitted_finished);
transaction->priv->emitted_finished = TRUE;

g_debug ("emitting finished '%s', %i",
pk_exit_enum_to_string (exit_enum),
time_ms);
Expand Down

0 comments on commit 64278c9

Please sign in to comment.