Avoid a crash when disabling a non-enabled extension with load errors.

Review Request #11926 — Created Jan. 11, 2022 and submitted

Information

Djblets
release-2.x

Reviewers

disable_extension() made an assumption that it should always send an
extension_disabled() signal, and that it always had an extension
object to pass in.

If the extension being disabled was never enabled but had a load error,
this assumption would break. This is a pretty obscure case, but one that
was hit with some test work.

We now set extension to None in this case, and only emit the signal
if not None.

Unit tests pass.

Verified this fixed the issue I was hitting in upcoming test changes.

Summary ID
Avoid a crash when disabling a non-enabled extension with load errors.
`disable_extension()` made an assumption that it should always send an `extension_disabled()` signal, and that it always had an `extension` object to pass in. If the extension being disabled was never enabled but had a load error, this assumption would break. This is a pretty obscure case, but one that was hit with some test work. We now set `extension` to `None` in this case, and only emit the signal if not `None`.
e42614beb6729ff6808f5aa7096c3dc300f0fa3a
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.x (d8340c3)