diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index b8a1b9638..b5a8636b0 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -287,7 +287,7 @@ 4DAB87C40ABE1F730081CF7E /* http.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = http.c; path = libtransmission/http.c; sourceTree = ""; }; 4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = ""; }; 4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = ""; }; - 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; }; + 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; }; 4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = ""; }; 4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = ""; }; 4DDFDD21099A5D8E00189D81 /* UploadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = UploadBadge.png; path = macosx/Images/UploadBadge.png; sourceTree = ""; }; diff --git a/macosx/PiecesView.m b/macosx/PiecesView.m index 830040293..84a6ac260 100644 --- a/macosx/PiecesView.m +++ b/macosx/PiecesView.m @@ -135,9 +135,10 @@ //determine relevant values fNumPieces = MAX_ACROSS * MAX_ACROSS; - if ([fTorrent pieceCount] < fNumPieces) + int pieceCount = [fTorrent pieceCount]; + if (pieceCount < fNumPieces) { - fNumPieces = [fTorrent pieceCount]; + fNumPieces = pieceCount; fAcross = sqrt(fNumPieces); if (fAcross * fAcross < fNumPieces) @@ -160,10 +161,7 @@ if (!fTorrent) return; - if (first) - [fImageView setImage: [[fBack copy] autorelease]]; - - NSImage * image = [fImageView image]; + NSImage * image = first ? [fBack copy] : [fImageView image]; int8_t * pieces = malloc(fNumPieces); [fTorrent getAvailability: pieces size: fNumPieces]; @@ -179,7 +177,10 @@ { index++; if (index >= fNumPieces) + { + i = fAcross; break; + } pieceImage = nil; @@ -243,7 +244,14 @@ if (change) { [image unlockFocus]; - [fImageView setNeedsDisplay]; + + if (first) + { + [fImageView setImage: image]; + [image release]; + } + else + [fImageView setNeedsDisplay]; } free(pieces);