Modal sessions with PyQt4 and OS X



  • Hello. I noticed that there finally seems to be a fix for QTBUG-37699. I ported the fix to Qt4 and applied it to a program I maintain that was suffering from this problem. The good news is that, as best I can tell, the problem is mostly solved, and the program no longer suffers from random crashes. The bad news is that it has introduced a new issue. If anybody can help with this, I'd really appreciate it. (Oh, and FYI, I see this problem on Mavericks. I haven't fired up any of my OS X VMs just yet to test elsewhere.)

    When the GUI starts up, let's say I open another window, and sometimes open more sub-windows from the new window. What I've discovered is that the program can enter a zombie state of sorts where I can't click anything. If I click anywhere in the window, OS X just beeps at me. I can drag the window around. I just can't click anything, and if I click any program entries in the taskbar at the top, everything is greyed out, or some things will be greyed out while others can be clicked, but there's no guarantee that what should happen will happen. Sometimes, the program eventually returns to normal. Other times, it seems to get stuck forever, at which point I have to right-click on the program icon and click "Quit".

    Any idea what might be happening? I still see the occasional message like the following on the command line. Such messages are rare, though, and aren't always triggered when the program goes haywire. In addition, the "reentrant call" line sometimes appears by itself.


    2014-07-12 12:37:45.486 Python[83151:507] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
    2014-07-12 12:37:47.490 Python[83151:507] -[NSApplication runModalSession:]: Use of freed session detected. Do not call runModalSession: after calling endModalSesion:.

    Thanks in advance for any help you can give! I'll get in touch with the developers too and see if they can help.



  • Update: The 37699 patch I put together was incomplete. Once I put together both deliveries, the program stopping going into its zombie state. That said, I am still getting the runModalSession/endModalSesion warnings on a regular basis when windows are closed. If anybody has any suggestions for that one, I'd really appreciate it.





  • Hello. There are some similarities there. I can't say for sure but you may want to try applying "this patch":https://github.com/etotheipi/BitcoinArmory/blob/devel/osxbuild/QTBUG-37699.patch as a test. It's a 37699 patch for Qt4 that I put together. It seems reasonably robust so far.



  • Hello. I thought I'd bump this one and see if anybody out there does have a suggestion for the following warning under Qt4. On my program, I get this any time I close a window.


    2014-08-03 15:24:10.601 Python[15821:507] -[NSApplication runModalSession:]: Use of freed session detected. Do not call runModalSession: after calling endModalSesion:.

    I spent the entire weekend trying to deal with this, as the warning does occasionally lead to a crash. The best I can do - selectively backporting Qt5 code to Qt4 - seems to make the problem go away 30-40% of the time. It makes me think there's a race condition, or perhaps a simple call I need to make that would squash something deep within Qt that triggers everything.

    Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.