1

I have two PySide programs that use a UI with many of the same elements. I've constructed a UI that imports several shared QGroupBox and one that differs. One program works, the other locks up before the GUI appears, and no longer responds to keyboard interrupts.

But. I want to know why introducing set_trace() fixes things. The following:

 ui = UI(initValues)
 vcs.show()

hangs. The code successfully makes it through the instantiation, but then the show() never shows anything. However:

 ui = UI(initValues)
 ipdb.set_trace()
 vcs.show()

followed by typing "c" to the ipdb prompt and everything works as I expect it to. The GUI shows up and the program works fine. I've tried replacing the set_trace() with input() and with sleep(), both of which exhibit the original problem.

Ubuntourist
  • 775
  • 11
  • 26
  • Post an [MCVE](http://stackoverflow.com/help/mcve) that demonstrates the problem. – ekhumoro Feb 14 '16 at 18:53
  • Sadly, that's part of my problem. Both the program that works and the program that only works with set_trace() added have become rather large. I added the set_trace() to try to narrow down where the problem was... but adding it made the program work. So I don't know what would make a minimal complete verifiable... (Also, the researcher I'm working for is paranoid about sharing code. So, just posting the whole thing somewhere won't do either.) – Ubuntourist Feb 14 '16 at 21:22
  • 2
    Your description suggests the debugger is keeping objects alive that would otherwise be garbage-collected. Is the code in your question part of a function that simply returns after the `vcs.show()` line? If so, the `vcs` object will be immediately garbage-collected once it goes out of scope. You need to keep a reference to it, or give it a parent. – ekhumoro Feb 14 '16 at 21:45
  • @ekhumoro I'm suspecting you've hit upon it, and that the other program works by virtue of sheer luck rather than correct coding. It should also encounter the garbage collection error but I suspect garbage collection for that program is perhaps less frequent. Thanks. – Ubuntourist Feb 14 '16 at 22:52

0 Answers0