tombenner/nui — pull request #281 by Wenzhi (2014-12-30 23:20:50+00:00)
Title: fix the crash lead by the NUIBarButtonItemRenderer bug

Rendering the UIBarButton twice would lead to a crash " Exception: replaced layer is not a sublayer of ".

After investigation, I found that the issue is in the line 35:
`[layer insertSublayer:gradientLayer atIndex:backgroundLayerIndex];`
It's trying to replace a sublayer of the `layer`, which is newly generated at line 23: `CALayer *layer = [CALayer layer];`, which doesn't have any sublayer. That leads to the crash.