diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-02-20 22:27:43 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-02-20 22:27:43 (GMT) |
commit | 599ce9c6c2299b085011c426f0893d494cf9403d (patch) | |
tree | 74cf648aeccf4798572a69adcc4aa6b3c34e4a9d /Mac/Modules/dlg/dlgsupport.py | |
parent | c05abb3bdaa87b6e5ea2d6db1e5d6145ae2b0440 (diff) | |
download | cpython-599ce9c6c2299b085011c426f0893d494cf9403d.zip cpython-599ce9c6c2299b085011c426f0893d494cf9403d.tar.gz cpython-599ce9c6c2299b085011c426f0893d494cf9403d.tar.bz2 |
On OSX passing NULL to NewUniversalFilterProc() does not return NULL but a crashing UPP. This made ModalDialog (and, hence EditPythonPrefs and EasyDialogs and many others) crash. Fixed.
Diffstat (limited to 'Mac/Modules/dlg/dlgsupport.py')
-rw-r--r-- | Mac/Modules/dlg/dlgsupport.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py index ab22e18..594b7a8 100644 --- a/Mac/Modules/dlg/dlgsupport.py +++ b/Mac/Modules/dlg/dlgsupport.py @@ -15,7 +15,7 @@ DialogRef = DialogPtr OptHandle = OpaqueByValueType("Handle", "OptResObj") ModalFilterProcPtr = InputOnlyType("PyObject*", "O") -ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterProc(%s))" % name +ModalFilterProcPtr.passInput = lambda name: "Dlg_PassFilterProc(%s)" % name ModalFilterUPP = ModalFilterProcPtr RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") @@ -79,10 +79,12 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog, return rv; } -static ModalFilterProcPtr +static ModalFilterUPP Dlg_PassFilterProc(PyObject *callback) { PyObject *tmp = Dlg_FilterProc_callback; + static ModalFilterUPP UnivFilterUpp = NULL; + Dlg_FilterProc_callback = NULL; if (callback == Py_None) { Py_XDECREF(tmp); @@ -91,7 +93,9 @@ Dlg_PassFilterProc(PyObject *callback) Py_INCREF(callback); Dlg_FilterProc_callback = callback; Py_XDECREF(tmp); - return &Dlg_UnivFilterProc; + if ( UnivFilterUpp == NULL ) + UnivFilterUpp = NewModalFilterUPP(&Dlg_UnivFilterProc); + return UnivFilterUpp; } static PyObject *Dlg_UserItemProc_callback = NULL; @@ -267,7 +271,7 @@ setuseritembody = """ return NULL; } - if (new == Py_None) { + if (new == NULL || new == Py_None) { new = NULL; _res = Py_None; Py_INCREF(Py_None); |