I have three push buttons: the sender button ('Click me!') that i connect to a slot named on_button_clicked(). Two other buttons connect/disconnect the sender's clicked signal to the slot.
I click on a button to create a signal-slot connection for another button (the 'Click me!' button). Clicking 10 times creates 10 connections. Clicking the sender button executes the slot 10 times. Clicking the disconnect button removes one connection. Clicking the disconnect button again disconnect all the remaining 9 connections and further clicks on the sender button do not execute the slot:
1
2
3
4
5
6
7
8
9
10
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
9
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
Button clicked
8
<<< at this point clicking the sender button does not execute the signal
/home/jon/Documents/java/eclipse-workspace/PySideLearning/bugs/01_disconnect.py:51: RuntimeWarning: Failed to disconnect (<bound method Window.on_button_clicked of <_main_.Window(0x55a9352caea0) at 0x7f91aaf56300>>) from signal "clicked()".
ok = self.button.clicked.disconnect(self.on_button_clicked)
Failed to disconnect
8