Commits

Ronald Oussoren committed 5e55251

- Fix signature for a method in NSSavePanel
- Add testcase for this
- Noticed, but didn't fix, that we increase a reference count without
releasing it in objc-class.m. Should be fixed later, this could cause
problems with long-living applications.

  • Participants
  • Parent commits b48a121

Comments (0)

Files changed (4)

File pyobjc/Lib/AppKit/_AppKitSignatures.py

-
-#
-# This file is generated by 'create_byref_module.py'. Do not edit.
-#
-# Generated from 'Lib/AppKit/AppKit.byref'.
-#
-#
 from objc import setSignatureForSelector
 
 setSignatureForSelector("NSFocusState", "clip:", "@@:i^{_NSRect={_NSPoint=ff}{_NSSize=ff}}")
 setSignatureForSelector("NSLayoutManager", "temporaryAttributesAtCharacterIndex:effectiveRange:", "@@:Io^{_NSRange=II}")
 setSignatureForSelector("NSLayoutManager", "textContainerForGlyphAtIndex:effectiveRange:", "@@:Io^{_NSRange=II}")
 setSignatureForSelector("NSOpenPanel", "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", "v36@4:8@12@16@20@24@28:32i40")
+setSignatureForSelector("NSSavePanel", "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", "v36@4:8@12@16@20@24@28:32i40")
 setSignatureForSelector("NSPrintOperation", "runOperationModalForWindow:delegate:didRunSelector:contextInfo:", "v20@4:8@12@16:20i24")
 setSignatureForSelector("NSSpellChecker", "checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:", "{_NSRange=II}@:@i@cio^i")
 setSignatureForSelector("NSSpellChecker", "checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:reconnectOnError:", "{_NSRange=II}@:@i@cio^ic")

File pyobjc/Lib/objc/test/test_regr.py

         import AppKit
         AppKit.NSColor.redColor().getRed_green_blue_alpha_()
 
+    def testOpenPanelSignature(self):
+        """
+        This test failed sometime after the 1.0b1 release (on Panther).
+        """
+        import AppKit
+
+        o = AppKit.NSOpenPanel.openPanel()
+        sig = o.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo_.signature
+        dclass= o.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo_.definingClass
+        sig = ''.join(objc.splitSignature(sig))
+        self.assertEquals(
+            sig,
+            'v@:@@@@@:i')
+
 if __name__ == '__main__':
     unittest.main()

File pyobjc/Modules/objc/objc-class.m

 		if (!recursive) break;
 		if (info->class->super_class == NULL) break;
 		cls = PyObjCClass_New(info->class->super_class);
+			/* ^^^ REFCNT leak!! */
 		info = get_class_info(cls);
 
 	}

File pyobjc/Modules/objc/objc-object.m

 		dict = ((PyTypeObject *)base)->tp_dict;
 		assert(dict && PyDict_Check(dict));
 		descr = PyDict_GetItem(dict, name);
-		if (descr != NULL)
+		if (descr != NULL) {
 			break;
+		}
 	}
 
 	return descr;