diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index a87639fe245ae395224576ac43001e654e0ee974..7af40045490538aecb23fafa402425d09fa00552 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,18 @@ +2012-01-06 Alexey Proskuryakov + + [Mac] Thread verifier assertions when printing + https://bugs.webkit.org/show_bug.cgi?id=75738 + + Reviewed by Sam Weinig. + + * UIProcess/API/mac/WKPrintingView.mm: + (-[WKPrintingView dealloc]): Dealloc in main thread, so that WebFrameProxy doesn't get + deref'ed from a secondary one. + (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): This method calls out to client, + which only expects that on main thread. + (-[WKPrintingView knowsPageRange:]): Call _adjustPrintingMarginsForHeaderAndFooter on main + thread. + 2012-01-06 Alexey Proskuryakov Need to allow SCNetworkReachability service in sandbox profile diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm index 14fe79add21d93c95b95a51fc6bfc246ea638acc..5ab899f5f31dac8ebd955718e99ee39e8de442bd 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm @@ -30,6 +30,7 @@ #import "PrintInfo.h" #import "WebData.h" #import "WebPageProxy.h" +#import #import using namespace WebKit; @@ -56,6 +57,14 @@ static BOOL isForcingPreviewUpdate; return self; } +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([WKPrintingView class], self)) + return; + + [super dealloc]; +} + - (BOOL)isFlipped { return YES; @@ -110,6 +119,8 @@ static BOOL isForcingPreviewUpdate; - (void)_adjustPrintingMarginsForHeaderAndFooter { + ASSERT(isMainThread()); // This funciton calls the client, which should only be done on main thread. + NSPrintInfo *info = [_printOperation printInfo]; NSMutableDictionary *infoDictionary = [info dictionary]; @@ -364,7 +375,7 @@ static void prepareDataForPrintingOnSecondaryThread(void* untypedContext) [self _suspendAutodisplay]; - [self _adjustPrintingMarginsForHeaderAndFooter]; + [self performSelectorOnMainThread:@selector(_adjustPrintingMarginsForHeaderAndFooter) withObject:nil waitUntilDone:YES]; if ([self _hasPageRects]) *range = NSMakeRange(1, _printingPageRects.size());