-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix desktop reference counting #4094
Conversation
Increment the desktop instance's "application reference count" in Design.__enter__ instead of Design.__init__ to avoid increasing the reference count incorrectly when, for example, Hfss.set_active_design is called. Fixes #4092
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4094 +/- ##
==========================================
+ Coverage 81.86% 81.87% +0.01%
==========================================
Files 184 184
Lines 63987 63966 -21
==========================================
- Hits 52380 52374 -6
+ Misses 11607 11592 -15 |
Add a test for the behavior described in issue 4092, and fix the reference counting logic so that the reference count is decremented from even from one to zero. This ensures that the reference count is correct even if the desktop instance is not design-initialized and so is not released by Design.__exit__.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Increment the desktop instance's "application reference count" in
Design.__enter__
instead ofDesign.__init__
to avoid increasing the reference count incorrectly when, for example,Hfss.set_active_design
is called.Also remove unnecessarily duplicated
__enter__
definitions in each application subclass, leaving onlyDesign.__enter__
.Fixes #4092