diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-01-13 16:24:32 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-01-13 16:24:32 (GMT) |
commit | 2c6cf972554817772952c29b762df827200fdd78 (patch) | |
tree | d50b5301d71af051e09233a6ec1325cf2c5dd44c | |
parent | 3d6163ad2d2ad255f19fb9a2c643c602b3155728 (diff) | |
download | cpython-2c6cf972554817772952c29b762df827200fdd78.zip cpython-2c6cf972554817772952c29b762df827200fdd78.tar.gz cpython-2c6cf972554817772952c29b762df827200fdd78.tar.bz2 |
Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
-rw-r--r-- | Mac/Modules/Nav.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c index 236089f..452baa1 100644 --- a/Mac/Modules/Nav.c +++ b/Mac/Modules/Nav.c @@ -147,6 +147,7 @@ filldialogoptions(PyObject *d, int pos = 0; PyObject *key, *value; char *keystr; + AEDesc *defaultLocation_storage; NavGetDefaultDialogOptions(opt); @@ -157,8 +158,15 @@ filldialogoptions(PyObject *d, } keystr = PyString_AsString(key); if( strcmp(keystr, "defaultLocation") == 0 ) { - if ( !PyArg_Parse(value, "O&", AEDesc_Convert, defaultLocationP) ) + if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) { + PyErr_NoMemory(); return 0; + } + if ( !PyArg_Parse(value, "O&", AEDesc_Convert, defaultLocation_storage) ) { + PyMem_DEL(defaultLocation_storage); + return 0; + } + *defaultLocationP = defaultLocation_storage; } else if( strcmp(keystr, "version") == 0 ) { if ( !PyArg_Parse(value, "h", &opt->version) ) return 0; @@ -435,6 +443,7 @@ nav_NavGetFile(self, args, kw) return NULL; err = NavGetFile(defaultLocation, &reply, &dialogOptions, eventProc, previewProc, filterProc, typeList, (void *)dict); + PyMem_XDEL(defaultLocation); if ( err ) { PyErr_Mac(ErrorObject, err); return NULL; @@ -471,6 +480,7 @@ nav_NavPutFile(self, args, kw) return NULL; err = NavPutFile(defaultLocation, &reply, &dialogOptions, eventProc, fileType, fileCreator, (void *)dict); + PyMem_XDEL(defaultLocation); if ( err ) { PyErr_Mac(ErrorObject, err); return NULL; @@ -606,6 +616,7 @@ nav_NavChooseFile(self, args, kw) return NULL; err = NavChooseFile(defaultLocation, &reply, &dialogOptions, eventProc, previewProc, filterProc, typeList, (void *)dict); + PyMem_XDEL(defaultLocation); if ( err ) { PyErr_Mac(ErrorObject, err); return NULL; @@ -641,6 +652,7 @@ nav_NavChooseFolder(self, args, kw) return NULL; err = NavChooseFolder(defaultLocation, &reply, &dialogOptions, eventProc, filterProc, (void *)dict); + PyMem_XDEL(defaultLocation); if ( err ) { PyErr_Mac(ErrorObject, err); return NULL; @@ -676,6 +688,7 @@ nav_NavChooseVolume(self, args, kw) return NULL; err = NavChooseVolume(defaultLocation, &reply, &dialogOptions, eventProc, filterProc, (void *)dict); + PyMem_XDEL(defaultLocation); if ( err ) { PyErr_Mac(ErrorObject, err); return NULL; @@ -711,6 +724,7 @@ nav_NavChooseObject(self, args, kw) return NULL; err = NavChooseObject(defaultLocation, &reply, &dialogOptions, eventProc, filterProc, (void *)dict); + PyMem_XDEL(defaultLocation); if ( err ) { PyErr_Mac(ErrorObject, err); return NULL; @@ -744,6 +758,7 @@ nav_NavNewFolder(self, args, kw) if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL)) return NULL; err = NavNewFolder(defaultLocation, &reply, &dialogOptions, eventProc, (void *)dict); + PyMem_XDEL(defaultLocation); if ( err ) { PyErr_Mac(ErrorObject, err); return NULL; |