Re: Cocoa-dev Digest, Vol 8, Issue 553
There is a workaround for this bug. See this answer to the same question on Stack Overflow: http://stackoverflow.com/questions/2616738/linking-to-libcrypto-for-leopard/2620698#2620698 I haven't tested whether this bug still exists in Lion or not, but if it does, that workaround will likely still work. -- Simone Il giorno Jul 23, 2011, alle ore 14:43, cocoa-dev-requ...@lists.apple.com ha scritto: > What's got fixed, and what GM ? > > AFAIK, if you link on libcrypto from the 10.6 or 10.7 SDK (whatever Xcode > version you use), you cannot run your application on 10.5. > > > -- Jean-Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Non-Sub-Pixel Rendering Font Rendering Differences when using Core Animation
I'm adding some Core Animation to my existing project, and I'm encountering some differences in the font rendering compared to non-Core Animation code. Here's the code used to draw my strings: > NSShadow *selectedShadow = [[NSShadow alloc] init]; > [selectedShadow setShadowOffset:NSMakeSize(0,-1)]; > [selectedShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 > alpha:0.33]]; > [selectedShadow autorelease]; > > NSMutableParagraphStyle *leftAlignedEllipsisStyle = [[NSMutableParagraphStyle > alloc] init]; > [leftAlignedEllipsisStyle setAlignment:NSLeftTextAlignment]; > [leftAlignedEllipsisStyle setLineBreakMode:NSLineBreakByWordWrapping]; > [leftAlignedEllipsisStyle autorelease]; > > NSDictionary *selectedAttributes = [NSDictionary dictionaryWithObjectsAndKeys: > [NSFont systemFontOfSize:11.0], > NSFontAttributeName, > [NSColor whiteColor], > NSForegroundColorAttributeName, > selectedShadow, NSShadowAttributeName, > leftAlignedEllipsisStyle, > NSParagraphStyleAttributeName, > nil]; > > [someString drawWithRect:textRect >options:NSStringDrawingTruncatesLastVisibleLine | > NSStringDrawingUsesLineFragmentOrigin > attributes:selectedAttributes]; Here's the difference: http://homepage.mac.com/simx/images/antialiasing-diff.png On the left is text rendered in my existing project using the above code via the drawRect: method. On the right is text rendered into a CALayer using the drawLayer:inContext: method. I'm aware of the fact that Core Animation disables sub-pixel rendering for text when drawing to transparent backgrounds, so I've intentionally designed my CALayers so that they have opaque backgrounds. Sub-pixel rendering is definitely active now that I've drawn an opaque color to the layer. This doesn't seem to be the issue, especially because the Core Animation text appears *heavier* than the normal Quartz text, whereas it usually appears more wispy when sub-pixel rendering is off. Nor does this seem to be an issue with half-pixels. The selection bubble is rendering crisply (from image assets), which indicates that the layer is positioned correctly. And the text itself isn't blurred, so the text is also positioned correctly. This almost looks as if a heavier kind of antialiasing is active on the text. I recall that Mac OS X had four different types of antialiasing you could choose in the Appearance preference pane, but this preference is gone in more recent versions. Could I be hitting that and somehow using some different form of antialiasing? Any help would be greatly appreciated. -- Simone ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weak Linking Crash
Il giorno Mar 11, 2009, alle ore 6:22 PM, Greg Parker ha scritto: -weak_framework often doesn't work by itself. If the function declaration isn't marked weak_import in the header file, then the compiler may optimize out your `function != NULL` check and call the weak-linked function anyway. This workaround might help defeat the optimizer: // was: if (&function != NULL) function(); void * volatile function_p = &function; if (function_p != NULL) function(); OK, this seems to be the case. I found that the code that Apple suggests in its Weak Linking documentation to just not work. Even when *un*optimized, the compiler seems to always think the comparison in the if statement of the following code is true. int result = 0; if (MyWeakLinkedFunction != NULL) { result = MyWeakLinkedFunction(); } I have been using the following syntax: int result = 0; uintptr_t address = (uintptr_t)(MyWeakLinkedFunction); if (address != 0u) { result = MyWeakLinkedFunction(); } The compiler likes this when *un*optimized, but it looks like the compiler is optimizing this out, too. I found that when using your code, however, that I needed to explicitly cast the function as a void* before the compiler would build without errors: void * volatile function_p = (void *)&(MyWeakLinkedFunction); if (function_p == NULL) { result = MyWeakLinkedFunction(); } Thanks for your help! That solved the problem! -- Simone ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Weak Linking Crash
So I'm trying to weak link the SDL_mixer framework (svn source avaliable here: http://svn.libsdl.org/trunk/SDL_mixer ) to a Cocoa project, the Mac OS X port of Descent 2 (svn source available here: https://d2x-xl.svn.sourceforge.net/svnroot/d2x-xl ). I've followed the instructions on Apple's website about weak linking (see http://developer.apple.com/DOCUMENTATION/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html ). Specifically, I've added "-weak_framework SDL_mixer" in my Other Linker Flags build setting. Here's the problem: weak linking works well under *unoptimized* builds, but fails in *optimized* builds. The program launches correctly both with and without SDL_mixer present when unoptimized. However, as soon as I turn on optimization, the program crashes when the SDL_mixer framework is not present. The optimized build continues to work fine when the SDL_mixer framework *is* present. Since I'm shipping an optimized version, weak linking in this case is useless, because it provides no benefit over not weak linking. The program simply crashes if SDL_mixer is not present, no matter if it has been weak linked or not. The crash seems to occur *before* any code in my application; it crashes when trying to send an appDidFinishLaunching notification. Here is a partial stack trace: Thread 0 Crashed: 0 ??? 00 0 + 0 1 de.descent2.d2x-xl 0x0008bda3 0x1000 + 568739 2 de.descent2.d2x-xl 0x0008f7ed 0x1000 + 583661 3 de.descent2.d2x-xl 0x0008fb9c 0x1000 + 584604 4 de.descent2.d2x-xl 0x00057fc3 0x1000 + 356291 5 com.apple.Foundation0x90b53f1c _nsnote_callback + 364 6 com.apple.CoreFoundation 0x93ea38da __CFXNotificationPost + 362 7 com.apple.CoreFoundation 0x93ea3bb3 _CFXNotificationPostNotification + 179 8 com.apple.Foundation 0x90b51080 -[NSNotificationCenter postNotificationName:object:userInfo:] + 128 9 com.apple.Foundation 0x90b5a8c8 -[NSNotificationCenter postNotificationName:object:] + 56 10 com.apple.AppKit 0x91c8f49a -[NSApplication _postDidFinishNotification] + 125 11 com.apple.AppKit 0x91c8f3a9 -[NSApplication _sendFinishLaunchingNotification] + 77 12 com.apple.AppKit 0x91c08ec3 - [NSApplication(NSAppleEventHandling) _handleAEOpen:] + 284 13 com.apple.AppKit 0x91c086bc - [NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 98 14 com.apple.Foundation 0x90b7943f -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 655 15 com.apple.Foundation 0x90b7914f _NSAppleEventManagerGenericHandler + 223 16 com.apple.AE 0x916b1648 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*) + 144 17 com.apple.AE 0x916b157e dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 44 The whole crash report can be found here: http://homepage.mac.com/simx/weak_linking_crash_log.txt . Anybody know what's going on here and how to solve it? The intarwebs and the Googles don't seem to be providing anything relevant. Thanks in advance for any assistance. -- Simone ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair
Rick -- I pulled my hair out over this one, but I finally found an acceptable workaround, although it doesn't solve the fundamental problem of NSDictionaryController. What I ended up doing is setting the whole outer dictionary (the one controlled by the NSDictionaryController) via a KVO-compliant method. This sucks because it means that you'll have to manually write methods for the actions of your UI controls instead of relying on bindings to do it for you. But it *does* get around the paradox of either being unable to set properties of an individual object in the dictionary or violating KVO-compliance. So, for example, in my project, my NSDictionaryController is bound to the entriesDict of the selected EPWeblog object in my master-detail interface. When I want to change one of the objects in the dictionary, I do the following: NSMutableDictionary *tempMutDict = [NSMutableDictionary dictionaryWithDictionary:[weblog entriesDict]]; [tempMutDict setObject:dictionaryValue forKey:theExistingKey]; [weblog setEntriesDict:tempMutDict]; entriesDict is a property of the EPWeblog object (the variable 'weblog'), and it's KVO-compliant via the entriesDict and setEntriesDict: methods. So I simply copy the outer dictionary, change the one object in the dictionary (represented by the new dictionaryValue variable), and then set the outer dictionary via the setEntriesDict: method. If you call addObject: to your NSDictionaryController, it does precisely the same thing -- it adds a new object and sets the whole outer dictionary via the appropriate KVO- compliant method. After all this, I too am planning to file a bug on NSDictionaryController because this is pretty ridiculous for something that should be straightforward. I did a bunch of subclassing to figure out exactly what NSDictionaryController was doing. Even if the dictionary it's controlling contains mutable values inside its objects, NSDictionaryController represents them as immutable objects. It's infuriating. It does make me feel better that someone else is having this same problem, though. :) -- Simone Il giorno 2009-01-06, alle ore 14:06, Rick Hoge ha scritto: I'm using an NSDictionaryController object to control the data provided to an NSTableView object. I'm attempting to use key-value coding through the dictionary controller to manipulate the data in a bindings-compatible way, by calling the method -arrangedObjects on the NSDictionaryController, and then manipulating the NSDictionaryControllerKeyValuePairs that this method returns in an array. Any luck? I am having a similar problem - mutable dictionary objects that are themselves stored in a dictionary will be presented as immutable dictionaries by the NSDictionaryController. This makes it impossible to bind controls to keypaths that drill into dictionaries below the level of the outermost container. i.e. even if arrangedObjects.value should point to a mutable dictionary, attempts to edit arrangedObjects.value.someKey via a UI control will generate the following error: *** -[NSCFDictionary setObject:forKey:]: mutating method sent to immutable object Having a workaround for this would be really nice - has anyone found one? I will file a bug as I don't think this is the behavior most would expect. This is turning something that would have "just worked" in about fifteen minutes into yet another quest for a messy workaround... Thanks in advance, Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Custom NSDictionaryController object class
I'm having a problem with NSDictionaryController. I created a class named EPCustomClass that I want to use as the object class that NSDictionaryController uses when returning objects from methods such as -newObject or -arrangedObjects. So on wake from nib, I've sent - setObjectClass:[EPCustomClass class] to my NSDictionaryController (that's instantiated in a nib) to tell it to use the new objects. But my custom methods don't seem to be used. These objects conform to the NSDictionaryControllerKeyValuePair protocol, but if I put an NSLog line inside my -setValue: method, the log line doesn't get printed at all even when I call -setValue: on one of these objects. Furthermore, objects returned by my NSDictionaryControllers methods don't seem to respond to custom methods that I've implemented in EPCustomClass; it just says that an unrecognized selector was sent to that object. What's going on here? When I call -objectClass on my NSDictionaryController, it's correctly returning EPCustomClass, but it doesn't seem to be using any of the modifications I've used to the class!? This can't possibly be normal behavior. What am I doing wrong? -- Simone ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Maintaining mutable values with NSDictionaryControllerKeyValuePair
I'm using an NSDictionaryController object to control the data provided to an NSTableView object. I'm attempting to use key-value coding through the dictionary controller to manipulate the data in a bindings-compatible way, by calling the method -arrangedObjects on the NSDictionaryController, and then manipulating the NSDictionaryControllerKeyValuePairs that this method returns in an array. The problem is that my values for the objects that -arrangedObjects returns also need to be mutable dictionaries themselves. That is, my NSDictionaryControllerKeyValuePairs look like this: key:someKey value: NSMutableDictionary key: someKey1 value: someString1 key: someKey2 value: someString2 If I attempt to set the values within the NSMutableDictionary directly via key-value coding on a completely new object, by calling - setValue:forKeyPath:@"value.someKey1", I get errors saying that this class isn't KVC compliant for the key someKey1 (presumably because the KeyValuePair doesn't automatically know that I want to create an NSMutableDictionary as the value). So I'm left with manually creating the NSMutableDictionary value (which is fine), and then calling setValue: on the KeyValuePair. The problem is, even if I use an NSMutableDictionary as the value, the KeyValuePair seems to set it with an immutable value instead (NSDictionary, rather than NSMutableDictionary). I can see this because if I then call setValue:forKeyPath:@"value.someKey1", I get an error saying I'm sending a mutable method to an immutable object. But I'm stuck, because I can't later set an entirely different NSMutableDictionary value to the KeyValuePair if I have my table observing someString1 or someString2, because that violates KVO. How do I get around this problem? Is there a way to tell NSDictionaryControllerKeyValuePair to preserve the mutability of the values that I'm setting? It seems that it might have internal copy semantics when setting the value rather than retain semantics, which would cause the problems I'm seeing. I hope that all made sense. Any help would be greatly appreciated. Thanks! -- Simone Manganelli ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com