diff options
Diffstat (limited to 'camel/camel-operation.c')
-rw-r--r-- | camel/camel-operation.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/camel/camel-operation.c b/camel/camel-operation.c index 0b5678d29a..dce3340b9a 100644 --- a/camel/camel-operation.c +++ b/camel/camel-operation.c @@ -291,8 +291,12 @@ void camel_operation_register(CamelOperation *cc) } } - cc->id = id; - g_hash_table_insert(operation_active, (void *)id, cc); + if (cc->id == (~0)) { + cc->id = id; + g_hash_table_insert(operation_active, (void *)id, cc); + } else { + g_warning("Re-registering thread %d for cancellation as thread %d", cc->id, id); + } d(printf("registering thread %ld for cancellation\n", id)); @@ -322,8 +326,14 @@ void camel_operation_unregister(CamelOperation *cc) } } - if (cc) - g_hash_table_remove(operation_active, (void *)cc->id); + if (cc) { + if (cc->id != (~0)) { + g_hash_table_remove(operation_active, (void *)cc->id); + cc->id == ~0; + } else { + g_warning("Unregistering an operation that was already unregistered"); + } + } CAMEL_ACTIVE_UNLOCK(); |