Skip to content
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

Merged
merged 5 commits into from
Jan 19, 2024
Merged

Fix desktop reference counting #4094

merged 5 commits into from
Jan 19, 2024

Conversation

isaacansys
Copy link
Collaborator

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.

Also remove unnecessarily duplicated __enter__ definitions in each application subclass, leaving only Design.__enter__.

Fixes #4092

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
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (81b5f72) 81.86% compared to head (fbd7620) 81.87%.
Report is 1 commits behind head on main.

❗ Current head fbd7620 differs from pull request most recent head 305e20c. Consider uploading reports for the commit 305e20c to get more accurate results

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__.
Copy link
Collaborator

@Alberto-DM Alberto-DM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! LGTM.

pyaedt/application/Design.py Outdated Show resolved Hide resolved
Copy link
Member

@Samuelopez-ansys Samuelopez-ansys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

pyaedt/application/Design.py Outdated Show resolved Hide resolved
pyaedt/application/Design.py Outdated Show resolved Hide resolved
@Samuelopez-ansys Samuelopez-ansys enabled auto-merge (squash) January 19, 2024 07:41
@Samuelopez-ansys Samuelopez-ansys merged commit a53f78d into main Jan 19, 2024
14 checks passed
@Samuelopez-ansys Samuelopez-ansys deleted the issue-4092 branch January 19, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling set_active_design prevents design-initialized Desktop from closing on __exit__
3 participants