adium 4245:dbdeb1472d96: Fix a crash when caching an emoticon's ...
commits at adium.im
commits at adium.im
Mon Oct 24 17:57:09 UTC 2011
details: http://hg.adium.im/adium/rev/dbdeb1472d96
revision: 4245:dbdeb1472d96
branch: (none)
author: Stephen Holt <sholt at adium.im>
date: Mon Oct 24 10:48:30 2011 -0700
Fix a crash when caching an emoticon's attributed string replacement from multiple threads. Force sequential access to this ivar.
Subject: adium 4246:da8be93c3421: Merging accidental new heads
details: http://hg.adium.im/adium/rev/da8be93c3421
revision: 4246:da8be93c3421
branch: (none)
author: Stephen Holt <sholt at adium.im>
date: Mon Oct 24 10:55:33 2011 -0700
Merging accidental new heads
diffs (131 lines):
diff -r 2e10c2e3fee2 -r da8be93c3421 ChangeLogs/Changes Between Betas.txt
--- a/ChangeLogs/Changes Between Betas.txt Sun Oct 23 13:56:50 2011 -0700
+++ b/ChangeLogs/Changes Between Betas.txt Mon Oct 24 10:55:33 2011 -0700
@@ -3,4 +3,6 @@
* Fixed a shadow drawing error under 64 bit in PSMTabBarController
* Fix issue where the user count was not updated when the user list is dragged open. (#15446)
* Fix issue where the state of the user list was not preserved when the user list is dragged open or closed.
-
\ No newline at end of file
+ * Fix connecting to Facebook using OAuth. (#15544)
+ * Fixed potential crash related to displaying emoticons.
+ * Fix connecting to Facebook using OAuth. (#15544)
diff -r 2e10c2e3fee2 -r da8be93c3421 Frameworks/Adium Framework/Source/AIEmoticon.m
--- a/Frameworks/Adium Framework/Source/AIEmoticon.m Sun Oct 23 13:56:50 2011 -0700
+++ b/Frameworks/Adium Framework/Source/AIEmoticon.m Mon Oct 24 10:55:33 2011 -0700
@@ -163,37 +163,47 @@
*/
- (NSMutableAttributedString *)attributedStringWithTextEquivalent:(NSString *)textEquivalent attachImages:(BOOL)attach
{
- NSMutableAttributedString *attributedString;
- AITextAttachmentExtension *attachment;
-
- //Cache this attachment for ourself if we don't already have a cache, or if our cache needs to have an image attached
- if (!_cachedAttributedString || (!imageLoaded && attach)) {
- [_cachedAttributedString release]; //for the second half of the conditional
- AITextAttachmentExtension *emoticonAttachment = [[[AITextAttachmentExtension alloc] init] autorelease];
- if(!path || attach) {
- NSTextAttachmentCell *cell = [[NSTextAttachmentCell alloc] initImageCell:[self image]];
- [emoticonAttachment setAttachmentCell:cell];
- [cell release];
- imageLoaded = YES;
- }
-
- [emoticonAttachment setPath:path];
- [emoticonAttachment setHasAlternate:YES];
- [emoticonAttachment setImageClass:@"emoticon"];
-
- //Emoticons should not ever be sent out as images
- [emoticonAttachment setShouldAlwaysSendAsText:YES];
+ static dispatch_queue_t cacheQueue;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ cacheQueue = dispatch_queue_create("dkfjh", 0);
+ });
+ __block NSMutableAttributedString *attributedString;
+ dispatch_sync(cacheQueue, ^{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ AITextAttachmentExtension *attachment;
- _cachedAttributedString = [[NSAttributedString attributedStringWithAttachment:emoticonAttachment] retain];
- }
-
- //Create a copy of our cached string, and update it for the new text equivalent
- attributedString = [_cachedAttributedString mutableCopy];
- attachment = [[attributedString attribute:NSAttachmentAttributeName atIndex:0 effectiveRange:NULL] copy];
- [attributedString addAttribute:NSAttachmentAttributeName value:attachment range:NSMakeRange(0, [attributedString length])];
- [attachment setString:textEquivalent];
- [attachment release];
-
+ //Cache this attachment for ourself if we don't already have a cache, or if our cache needs to have an image attached
+
+ if (!_cachedAttributedString || (!imageLoaded && attach)) {
+ [_cachedAttributedString release]; //for the second half of the conditional
+ AITextAttachmentExtension *emoticonAttachment = [[[AITextAttachmentExtension alloc] init] autorelease];
+ if(!path || attach) {
+ NSTextAttachmentCell *cell = [[NSTextAttachmentCell alloc] initImageCell:[self image]];
+ [emoticonAttachment setAttachmentCell:cell];
+ [cell release];
+ imageLoaded = YES;
+ }
+
+ [emoticonAttachment setPath:path];
+ [emoticonAttachment setHasAlternate:YES];
+ [emoticonAttachment setImageClass:@"emoticon"];
+
+ //Emoticons should not ever be sent out as images
+ [emoticonAttachment setShouldAlwaysSendAsText:YES];
+
+ _cachedAttributedString = [[NSAttributedString attributedStringWithAttachment:emoticonAttachment] retain];
+ }
+
+
+ //Create a copy of our cached string, and update it for the new text equivalent
+ attributedString = [_cachedAttributedString mutableCopy];
+ attachment = [[attributedString attribute:NSAttachmentAttributeName atIndex:0 effectiveRange:NULL] copy];
+ [attributedString addAttribute:NSAttachmentAttributeName value:attachment range:NSMakeRange(0, [attributedString length])];
+ [attachment setString:textEquivalent];
+ [attachment release];
+ [pool release];
+ });
return [attributedString autorelease];
}
diff -r 2e10c2e3fee2 -r da8be93c3421 Plugins/Purple Service/AIFacebookXMPPAccount.m
--- a/Plugins/Purple Service/AIFacebookXMPPAccount.m Sun Oct 23 13:56:50 2011 -0700
+++ b/Plugins/Purple Service/AIFacebookXMPPAccount.m Mon Oct 24 10:55:33 2011 -0700
@@ -411,7 +411,7 @@
error:NULL];
*/
- NSString *sessionKey = [[[self oAuthToken] componentsSeparatedByString:@"|"] objectAtIndex:1];
+ NSString *sessionKey = [self oAuthToken];
[[adium accountController] setPassword:sessionKey forAccount:self];
/* When we're newly authorized, connect! */
diff -r 2e10c2e3fee2 -r da8be93c3421 Plugins/Purple Service/libpurple_extensions/auth_fb.c
--- a/Plugins/Purple Service/libpurple_extensions/auth_fb.c Sun Oct 23 13:56:50 2011 -0700
+++ b/Plugins/Purple Service/libpurple_extensions/auth_fb.c Mon Oct 24 10:55:33 2011 -0700
@@ -105,7 +105,7 @@
request = purple_fbapi_construct_request(purple_connection_get_account(js->gc),
method,
"v", "1.0",
- "session_key", purple_connection_get_password(js->gc),
+ "access_token", purple_connection_get_password(js->gc),
"nonce", nonce,
NULL);
g_free(method);
diff -r 2e10c2e3fee2 -r da8be93c3421 Plugins/Purple Service/libpurple_extensions/fbapi.c
--- a/Plugins/Purple Service/libpurple_extensions/fbapi.c Sun Oct 23 13:56:50 2011 -0700
+++ b/Plugins/Purple Service/libpurple_extensions/fbapi.c Mon Oct 24 10:55:33 2011 -0700
@@ -262,8 +262,8 @@
value = va_arg(args, const char *);
g_tree_insert(params, (char *)key, (char *)value);
- /* If we have a session_key then we need a call_id */
- if (g_str_equal(key, "session_key")) {
+ /* If we have an access_token then we need a call_id */
+ if (g_str_equal(key, "access_token")) {
struct timeval tv;
if (gettimeofday(&tv, NULL) != 0) {
time_t now;
More information about the commits
mailing list