Revision: 15230
http://sourceforge.net/p/skim-app/code/15230
Author: hofman
Date: 2025-05-18 21:10:49 +0000 (Sun, 18 May 2025)
Log Message:
-----------
compare whether block itself is registered for image generation, otherwise
ignore
Modified Paths:
--------------
trunk/SKPresentationView.m
Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m 2025-05-18 16:19:53 UTC (rev 15229)
+++ trunk/SKPresentationView.m 2025-05-18 21:10:49 UTC (rev 15230)
@@ -481,12 +481,8 @@
return nil;
}
-static inline BOOL imageOrBlockIsBlock(id imageOrBlock) {
- return imageOrBlock && [imageOrBlock isKindOfClass:[NSImage class]] == NO;
-}
-
static inline void cancelIfBlock(id imageOrBlock) {
- if (imageOrBlockIsBlock(imageOrBlock))
+ if (imageOrBlock && [imageOrBlock isKindOfClass:[NSImage class]] == NO)
dispatch_block_cancel((dispatch_block_t)imageOrBlock);
}
@@ -535,13 +531,14 @@
PDFPage *thePage = [[page document] pageAtIndex:pageIndex];
BOOL autoScales = [self autoScales];
+ __block void *myBlock = NULL;
dispatch_block_t block = dispatch_block_create(0, ^{
-
+
NSImage *image = imageByDrawingPageToBitmapImageRep(imageRep, thePage,
autoScales);
dispatch_async(dispatch_get_main_queue(), ^{
- if (predrawnImages && imageOrBlockIsBlock((__bridge
id)NSMapGet(predrawnImages, (void *)pageIndex))) {
+ if (predrawnImages && myBlock == NSMapGet(predrawnImages, (void
*)pageIndex)) {
NSMapRemove(predrawnImages, (void *)pageIndex);
if (image) {
NSUInteger currentIndex = [page pageIndex];
@@ -557,7 +554,8 @@
});
// set this block so we can cancel it
- NSMapInsert(predrawnImages, (void *)pageIndex, (__bridge void *)block);
+ myBlock = (__bridge void *)block;
+ NSMapInsert(predrawnImages, (void *)pageIndex, myBlock);
dispatch_async(predrawingQueue, block);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit