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: fix issues with SliderLabel strong reference #248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tlambert03
Copy link
Member

I found a case where SliderLabel prevented cleanup by holding onto a bound method. This cleans that up

@tlambert03 tlambert03 changed the title fix: fix issues with SliderLabel fix: fix issues with SliderLabel strong reference Jun 3, 2024
Copy link

codecov bot commented Jun 3, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.04%. Comparing base (952ac33) to head (4c57cfd).

Files with missing lines Patch % Lines
src/superqt/sliders/_labeled.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #248      +/-   ##
==========================================
- Coverage   87.09%   87.04%   -0.05%     
==========================================
  Files          46       46              
  Lines        3433     3436       +3     
==========================================
+ Hits         2990     2991       +1     
- Misses        443      445       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tlambert03
Copy link
Member Author

this is a real strange mess. The goal is to remove the partial and lambda usage in _labeled... but for some reason, merely commenting out the line:

        if connect is not None:
            self.editingFinished.connect(lambda: connect(self.value()))

in SliderLabel causes a segfault on pyside6.

not urgent, so going back in the pile for now

@Czaki
Copy link
Contributor

Czaki commented Oct 12, 2024

@tlambert03 could you point line in code?

@tlambert03
Copy link
Member Author

tlambert03 commented Oct 12, 2024

Sure, basically the goal of this PR is to:

  • remove use of partial here
  • get rid of connect argument here and the connection that happens in the init here ... instead, having anything that instantiates a SliderLabel worry about doing its own connections.
  • in doing that last step, get rid of the lambda here

(apologies for the crappy code...)

@Czaki
Copy link
Contributor

Czaki commented Oct 12, 2024

Ah. You do not use tox/nox that makes it harder to reproduce locally.

Could you try to check if store hard reference to connect when commenting out this part of code?
Because commenting out lambda connection means also lost the reference.

@tlambert03
Copy link
Member Author

prefer not to use nox/tox honestly.
however, i don't think it should be hard to reproduce. i just made a new environment, pip installed editable with tests, and installed the pyside6 extra (==6.7) and was able to reproduce it. i'm on mac fwiw.

don't have time to check the references now

@Czaki
Copy link
Contributor

Czaki commented Oct 12, 2024

I'm going sleep. If you do not do this, I will try tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants