$OpenBSD: patch-src_manage_c,v 1.11 2013/01/11 09:44:12 dcoppa Exp $

From 138e04fd4d50e5f80d445761de86c0c9617916b3 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Tue, 01 Jan 2013 15:31:08 +0000
Subject: Bugfix: Fix for_window moving of assigned windows (Thanks bafain)

This fixes a segfault when creating assigned and to be moved windows

--- src/manage.c.orig	Wed Dec 12 00:08:17 2012
+++ src/manage.c	Fri Jan 11 09:58:48 2013
@@ -402,6 +402,10 @@ void manage_window(xcb_window_t window, xcb_get_window
     /* Check if any assignments match */
     run_assignments(cwindow);
 
+    /* 'ws' may be invalid because of the assignments, e.g. when the user uses
+     * "move window to workspace 1", but had it assigned to workspace 2. */
+    ws = con_get_workspace(nc);
+
     /* If this window was put onto an invisible workspace (via assignments), we
      * render this workspace. It wouldn’t be rendered in our normal code path
      * because only the visible workspaces get rendered.
