Skip to content

Commit

Permalink
[startup] fixMayapy2011SegFault - allow manual invoking
Browse files Browse the repository at this point in the history
if it's called twice, won't double-install overrides (this makes manually
calling it allowable)

This still doesn't guarantee we will get the correct exit code in all
situations, as it's still possible for callers to get the original
(unwrapped) versions before they are wrapped
  • Loading branch information
Paul Molodowitch committed Mar 9, 2020
1 parent 2d099f2 commit a2dc935
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pymel/internal/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def uninitializeMayaOnPythonExit():
atexit.register(uninitializeMayaOnPythonExit)
_atExitCallbackInstalled = True

_fixMayapy2011SegFault_applied = False

# Have all the checks inside here, in case people want to insert this in their
# userSetup... it's currently not always on
Expand All @@ -425,6 +426,12 @@ def fixMayapy2011SegFault():
import platform
if platform.system() == 'Linux':
if om.MGlobal.mayaState() == om.MGlobal.kLibraryApp: # mayapy only
global _fixMayapy2011SegFault_applied
if _fixMayapy2011SegFault_applied:
return

_fixMayapy2011SegFault_applied = True

# In linux maya 2011, once maya has been initialized, if you try
# to do a 'normal' sys.exit, it will crash with a segmentation
# fault..
Expand Down

0 comments on commit a2dc935

Please sign in to comment.