Created
October 31, 2013 19:18
-
-
Save briandw/7255242 to your computer and use it in GitHub Desktop.
This will crash the Mac OS X Mavericks window server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RLCrashyView.m | |
// CrashyMcCrashy | |
// | |
// Created by brian on 10/31/13. | |
// Copyright (c) 2013 Rantlab. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> | |
@interface RLCrashyView : NSView | |
@end | |
#import "RLCrashyView.h" | |
#import <QuartzCore/QuartzCore.h> | |
@implementation RLCrashyView | |
- (id)initWithCoder:(NSCoder *)aDecoder | |
{ | |
if (self = [super initWithCoder:aDecoder]) | |
{ | |
CALayer *backingLayer = [CALayer layer]; | |
backingLayer.bounds = self.bounds; | |
self.layer = backingLayer; | |
[self setWantsLayer:YES]; | |
} | |
return self; | |
} | |
- (IBAction)crashMe:(id)sender | |
{ | |
CAShapeLayer *badShape = [CAShapeLayer layer]; | |
badShape.strokeColor = [NSColor redColor].CGColor; | |
[self.layer addSublayer:badShape]; | |
CGFloat length = 0.0; | |
CGFloat nan = 1.0 / length; | |
CGAffineTransform transform = (CGAffineTransform){ nan, nan, nan, nan, 0, 0 }; | |
CGMutablePathRef arrowPath = CGPathCreateMutable(); | |
CGPathMoveToPoint(arrowPath, &transform, length, 1); | |
CGPathAddLineToPoint(arrowPath, &transform, length, 0); | |
badShape.path = arrowPath; | |
CGPathRelease(arrowPath); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment