I’m in middle of developing pipeline tool using PyQt, application is supposed to run standalone and inside Maya.
The issue I’m having is Maya version closing unexpectedly without any error message. I’ve tried to trace problem to specific line, but it looks like it doesn’t crash in my code, it crashes during draw probably.
Thing that is interesting it that tool seems to work fine for first few bigger UI updates, but afterwards it just crashes. This persists through Maya process, so on every run after first one it crashes on first bigger UI update. After maya is restarted, tool again works for few updates.
Code for this project is getting huge and UI is complex, and i’m not using Qt Designer. (if this info matters)
I would guess that your UI update is triggering a callback (or probably more than one callback) and that these are conflicting or that they aren’t properly using the Maya API multithreading calls. IE utils.executeDeferred
If the tool is supposed to run either standalone or inside of maya, are you trying to host the QT app inside of a maya session? You may be able to simplify your problem set by communicating to an outside app using TCP rather than hosting inside of Maya with all the threading issues that entails.
@btribble, do you have any resource in how to avoid this things happening? I use emits and callbacks a lot. I’m probably also not cleaning UI properly (removing) after update, so that might be a problem, but it’s mostly QWidgetListItems, so that shouldn’t be an issue.
@Theodox, I’m hosting app inside maya, solution to network with maya using TCP is not option I’ve looked into yet, I will google a bit, but I use maya-lib extensively if ran inside maya, so that might be a pain to do.
You could try opening the Task Manager and seeing if the system memory usage is close to maxxed out before Maya crashes. That could indicate a memory leak.
Also, does your UI use a complicated tree model or a custom proxy model? I was playing around with inserting and removing rows in a proxy tree model once. I seem to recall that if the model indeces got out of sync with the view indeces that it would crash.
Today I learned that is possible to force create QWindow in Maya, instead of asking maya for new QMainWindow instance. This implementation was done half of a year ago and worked for some reason for some time, until I updated some stuff recently. I switched to proper way of doing this and now works without crashing. I usually did this correct way in older scripts, but somehow I was surprised this worked when I tried
you could try an alternative Qt build from a different source. Some Qt builds are just less stable than others. My guess is that it depends on the compiler settings and library combinations used to build a particular PyQt version.
I had Qt versions which randomly crashed (often on exit), and others which didn’t, when running the same Python code.
[QUOTE=RobertKist;26502]you could try an alternative Qt build from a different source. Some Qt builds are just less stable than others. My guess is that it depends on the compiler settings and library combinations used to build a particular PyQt version.
I had Qt versions which randomly crashed (often on exit), and others which didn’t, when running the same Python code.[/QUOTE]
I was looking for someone to mention this, this is what I think as well.
Since you mention that you are running the app Standalone as well, double check that you aren’t using the same builds of PyQt for both - Maya needs a specific Autodesk-modified copy whereas standalone does not. Like Robert mentions, it can sometime work with other builds, but every now and then you end up with an access violation or similar due to the very small differences between the two.
[QUOTE=ArYeS;26501]Today I learned that is possible to force create QWindow in Maya, instead of asking maya for new QMainWindow instance. This implementation was done half of a year ago and worked for some reason for some time, until I updated some stuff recently. I switched to proper way of doing this and now works without crashing. I usually did this correct way in older scripts, but somehow I was surprised this worked when I tried :)[/QUOTE]
ArYes, I’m curious what you mean force create QWindow in Maya as opposed to the usual QMainWindow instance? Care to explain what you did there?