nicklockwood / FXBlurView

[DEPRECATED]
Other
4.94k stars 713 forks source link

Crash in [FXBlurView snapshotOfUnderlyingView] under iOS 8 #79

Closed mathiasAichinger closed 9 years ago

mathiasAichinger commented 10 years ago

Hi,

I got the following crash under iOS 8 when scrolling a UITableView which is under the FXBlurView:

4 0x03036b5e in CGPathCreateWithRect ()

5 0x031014d9 in CGContextAddRect ()

6 0x047fffb0 in CA_CGContextAddRoundRect ()

7 0x04916043 in -[CALayer _renderBackgroundInContext:]()

8 0x049159f4 in -[CALayer renderInContext:]()

9 0x049174a7 in -[CALayer _renderSublayersInContext:]()

10 0x04915a2c in -[CALayer renderInContext:]()

11 0x049174a7 in -[CALayer _renderSublayersInContext:]()

12 0x04915a2c in -[CALayer renderInContext:]()

13 0x049174a7 in -[CALayer _renderSublayersInContext:]()

14 0x04915a2c in -[CALayer renderInContext:]()

15 0x049174a7 in -[CALayer _renderSublayersInContext:]()

16 0x04915a2c in -[CALayer renderInContext:]()

17 0x00b3cc13 in -[FXBlurView snapshotOfUnderlyingView]

18 0x00b3d5b8 in -[FXBlurView updateAsynchronously:completion:]

19 0x00b3a5e6 in -[FXBlurScheduler updateAsynchronously]

20 0x0382b717 in __NSFireDelayedPerform ()

Log output:

ssertion failed: (transform_is_valid(m)), function CGPathRef CGPathCreateWithRect(CGRect, const CGAffineTransform *), file Paths/CGPath.cc, line 179.

Currently I have no clue why this happens!

dcacenabes commented 10 years ago

I am getting the same error in iOS7 with a page view controller. It happens with dynamic blurring on.

roycable commented 10 years ago

I too am having this issue - limited to iOS 8 though.

Looks like the method -(updateAsynchronously: completion:) is being hit repeatably even though I haven't set the blur to update.

When I manually add return NO inside -(shouldUpdate), performance is back to that of iOS 7.

This is my initialisation code;

FXBlurView *_bgBlur = [[FXBlurView alloc] initWithFrame:_carouselBackground.bounds];
_bgBlur.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
_bgBlur.blurRadius = 15;
_bgBlur.tintColor = [UIColor clearColor];
[self.view addSubview:_bgBlur];

NB: I found this out by using Instruments on my application, which was showing 101% of my CPU being used causing all UI to be sluggish.

shineall commented 10 years ago

Is this issue is solved in 1.6.2 ? it only happen in iOS 8.

0x0000000186b88ad4 -[CALayer _renderBorderInContext:] + 296 7 QuartzCore 0x0000000186b875b4 -[CALayer renderInContext:] + 1068 8 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 9 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 10 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 11 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 12 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 13 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 14 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 15 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 16 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 17 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 18 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 19 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 20 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 21 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 22 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 23 QuartzCore 0x0000000186b8759c -[CALayer renderInContext:] + 1044 24 QuartzCore 0x0000000186b88500 -[CALayer _renderSublayersInContext:] + 400 25 QuartzCore 0x0000000186b87530 -[CALayer renderInContext:] + 936

roycable commented 10 years ago

I resolved this by explicitly setting _fxBlur.dynamic = NO; ie. looks like under iOS 8 the dynamic setting is defaulted to true... which probably means if you have multiple instances of FXBlurView, you'll have a number of views updating at once (bit of a performance hit).

shineall commented 10 years ago

@roycable Thank you for comment. But I am using dynamic mode somewhere~ Is there another way to avoid crash this even though dynamic is on.

dcacenabes commented 10 years ago

Not elegant, but if you are desperate you can always try-catch around the problematic line.

javiholcman commented 10 years ago

Working with my partner we find the same bug. In our case, was crashing on the renderInContext of a subview of the underlyingLayer. Apparently, they introduced a bug on the renderInContext when the view contains 0 in the width. Check the subviews and it frames. Good luck.

shineall commented 10 years ago

@David , @javiholcman

Thanks !! If I gonna catch the solution , i gonna share~

On Fri, Oct 31, 2014 at 1:02 PM, javiholcman notifications@github.com wrote:

Working with my partner we find the same bug. In our case, was crashing on the renderInContext of a subview of the underlyingLayer. Apparently, they introduced a bug on the renderInContext when the view contains 0 in the width. Check the subviews and it frames. Good luck.

— Reply to this email directly or view it on GitHub https://github.com/nicklockwood/FXBlurView/issues/79#issuecomment-61322178 .