Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This will crash the Mac OS X Mavericks window server.
//
// 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