On Thursday, January 10, 2008, at 11:56AM, "Christiaan Hofman" <[EMAIL PROTECTED]> wrote: > >On 10 Jan 2008, at 8:44 PM, Adam R. Maxwell wrote: > >> >> On Thursday, January 10, 2008, at 11:21AM, "Christiaan Hofman" >> <[EMAIL PROTECTED]> wrote: >>> I'm confused about the function getting URLs from the pboard. It >>> seems to leak when there are several representation of URLs. fileURL >>> and destURL are set without checking whether they were set before. >>> E.g. FireFox 3.x now puts a string and a URL on the pboard, so >>> destURL is set twice without a release. Also, is the URL from those >>> not added to toReturn twice? >> >> The leak is from adding the hack for broken browsers that don't use >> URL types. In general each iteration of the flavor loop should set >> one or both fileURL and destURL, but you're correct that destURL >> could be set twice now if someone puts a URL on the pasteboard as a >> string together with a correct representation (Finder doesn't do >> that). I should have added a stringURL variable as well. >> >> The separation of destURL and fileURL is only there to get the >> correct URL from a webloc, since it has both of those types. I >> haven't checked your changes, but there were some subtleties that >> took a while to get right on Leopard and Tiger. It'll have to be >> tested thoroughly on both platforms again. >> > >I made some errors at first, though your fileURL thing also had some >proiblems because kUTTypeFileURL also conforms to kUTTypeURL. Now it >should all work correctly.
I made similar errors last summer :). What problems were there? I checked first for conformance to if(kUTTypeFileURL)else if(kUTTypeURL). You can't have the same flavor twice for a given item, so each variable should only have been assigned once (the text case broke that as you noted). >>> Also is it correct that there is no NSURLPboardType put on the pboard >>> by FileView? Couldn't that be a problem with the interaction with >>> other programs? >> >> Yes and maybe. NSURLPboardType is broken, and not worth writing >> the the pasteboard unless you have a single selection. If I recall >> correctly, though, the pasteboard handles some coercion so URLs and >> filenames can get passed to other apps. >> >>> I also just checked the comment , and also on Tiger when you put >>> NSStringPboardType on the pboard, the Carbon pboard has >>> kUTTypeUTF8PlainText with the same value (as well as >>> kUTTypeUTF16PlainText, kUTTypeUTF16ExternalPlainText, and >>> com.apple.traditional-mac-plain-text). >> >> Good. Then we only need the kUTTypeUTF8PlainText registration and >> it should be handled in the Carbon flavor loop. >> >> -- >> adam > >Probably. Is there another way to add string data to the pboard? >Perhaps adding as data or property list? It should still be declared properly as string, in which case it'll be picked up. The pboard handles big and little endian UTF-16 bytes and other things, but all of those are also picked up by NSStringPboardType. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Bibdesk-develop mailing list Bibdesk-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-develop