feat(imex): Cancel BackupProvider when dropped#4242
Conversation
This ensures that the BackupProvider will be stopped as soon as the struct is dropped and the imex progress error event is emitted. This makes it easier to use and also makes sure that the ffi call dc_backup_provider_unref() does not lead to dangling resources.
|
@r10s would be great if you could confirm this behaviour meets what you'd expect from the FFI API. |
the additional error-event-on-abort is sth. the UI has to take care of - however, UIs have to be take care when accessing objects on events anyway. shutdown is hard :) so, i'd say, it is good. UIs can also make use of error-event-on-abort as there seems is a guarantee about either success or error event at the end now. also, it is properly documented. however, if the error-event-on-abort was not there before, we should consider to classify this as an API-change in changelog. |
There was already always an event, but it was wrongly the imex 1000 event (success) instead of imex 0 (failure). I've clarified this in the changelog. |
|
thanks! |
DcBackupProvider.unref() will soon also emit errors, see chatmail/core#4242 , but also before, this was only correct by coincidence
DcBackupProvider.unref() will soon also emit errors, see chatmail/core#4242 , but also before, this was only correct by coincidence
DcBackupProvider.unref() will soon also emit errors, see chatmail/core#4242 , but also before, this was only correct by coincidence
DcBackupProvider.unref() will soon also emit errors, see chatmail/core#4242 , but also before, this was only correct by coincidence
* make sure, only one error alert is shown DcBackupProvider.unref() will soon also emit errors, see chatmail/core#4242 , but also before, this was only correct by coincidence * do not handle events on shutdown DcBackupProvider.unref() may emit events, but that may happen also for other reasons. be explicit by a flag, relying on activity.isFinishing() or by the already removed observer seems error prone, esp. on future changes. do not make me think :)
This ensures that the BackupProvider will be stopped as soon as the struct is dropped and the imex progress error event is emitted. This makes it easier to use and also makes sure that the ffi call dc_backup_provider_unref() does not lead to dangling resources.
There were some alternatives to doing this, but I wanted to make sure dropping before it is finished also results in a Imex(0) aka SendProgress::Failed event.
Closes #4179