Skip to content

Instantly share code, notes, and snippets.

@briandw
Created October 31, 2013 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briandw/7255242 to your computer and use it in GitHub Desktop.
Save briandw/7255242 to your computer and use it in GitHub Desktop.
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