Closed MelvinWM closed 5 years ago
Allocated instance of IChannel
is passed to ctor DpaHandler2()
and thus it cannot be deleted in its dtor ~DpaHandler2()
as it really doesn't own it (who calls new must call delete). So I cannot accept this change.
It has to be done by other ways to ensure proper cleaning. For example a user can provide a wrapping class owning both IChannel
and DpaHandler2
and delete both in its dtor.
Does it help? If not, please open an issue, address your problem there (maybe code excerpt) and lets discuss other possibilities.
Thank you, that does help.
Dear @fmikulu , I have created https://github.com/iqrfsdk/clibdpa/issues/35 .
This change ensures that if users (when cleaning up their usage of 'clibdpa') only delete
DpaHandler2
, that theIChannel
resource will also be cleaned up. This could for instance happen when they restart a part of their system that uses IQRF and clibdpa.However, if there are users that also clean up the
IChannel
resource directly, this change might cause bugs and errors for them. This is basically a change of the interface for usingDpaHandler2
AFAICT (namely who owns the given resources and has the responsibility for cleaning them up), so it may make sense to reject the pull request.It seems to me that it may make sense to make this change, since it partially fits with the
IChannel
resource not being cleaned up directly in the example, and partially that I could imagine that an instance of theIChannel
resource is not meant to be reused across multipleDpaHandler2
instances, though I could well be wrong about this latter part.Testing performed
Only a small amount, ran a program with the change and saw the resources being cleaned up. No unit testing.