Skip to content

policy: assert that the auto-activate list is empty on dispose

Beniamino Galvani requested to merge bg/policy-dispose into main

Summary

We are currently asserting that the list of devices waiting for auto-activation in NMPolicy is not empty. This condition is always false because:

  • NMDevice holds a reference to NMManager
  • NMManager holds a reference to NMPolicy
  • on dispose, NMDevice asserts that it's not in NMPolicy's auto-activate list

Therefore if there is any NMDevice alive, NMPolicy must be alive as well. Instead, if there is no NMDevice alive the list must be empty.

The assertion could fail only when the NMPolicy instance gets disposed, which usually doesn't happen because it's still referenced at shutdown.

Fixes: aede2289 ('core: assert that devices are not registered when disposing NMPolicy')

Resolves: https://issues.redhat.com/browse/RHEL-44345

Merge request reports

Loading