[PyObjC-svn] r2266 - trunk/pyobjc/pyobjc-framework-Quartz/Modules

[email protected] Tue, 14 Jul 2009 02:12:18 -0500
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Tue Jul 14 02:12:18 2009
New Revision: 2266

Log:
Fix memory management errors, reported by Ratko Jagodic


Modified:
   trunk/pyobjc/pyobjc-framework-Quartz/Modules/_callbacks.m

Modified: trunk/pyobjc/pyobjc-framework-Quartz/Modules/_callbacks.m
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Quartz/Modules/_callbacks.m	(original)
+++ trunk/pyobjc/pyobjc-framework-Quartz/Modules/_callbacks.m	Tue Jul 14 02:12:18 2009
@@ -1514,7 +1514,7 @@
 	CGEventMask eventsOfInterest;
 	CFMachPortRef result = NULL;
 
-	if (!PyArg_ParseTuple(args, "OOOOO",
+	if (!PyArg_ParseTuple(args, "OOOOOO",
 		&py_tap, &py_place, &py_options, &py_eventsOfInterest,
 		&callback, &info)) {
 
@@ -1557,7 +1557,9 @@
 	}
 
 	PyObject* retval = PyObjC_ObjCToPython(@encode(CFMachPortRef), &result);
-	CFRelease(retval); /* Compensate for donated ref */
+	if (result != NULL) {
+		CFRelease(result); /* Compensate for donated ref */
+	}
 	return retval;
 }
 

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge