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

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

Log:
Another memory management issue


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:14:33 2009
@@ -1580,7 +1580,7 @@
 	CGEventMask eventsOfInterest;
 	CFMachPortRef result = NULL;
 
-	if (!PyArg_ParseTuple(args, "OOOOO",
+	if (!PyArg_ParseTuple(args, "OOOOOO",
 		&py_psn, &py_place, &py_options, &py_eventsOfInterest,
 		&callback, &info)) {
 
@@ -1623,7 +1623,9 @@
 	}
 
 	PyObject* retval = PyObjC_ObjCToPython(@encode(CFMachPortRef), &result);
-	CFRelease(retval); /* Compensate for donated ref */
+	if (result) {
+		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