Blender crashed when assigning background image to 3d window, when no buttons window was visible. This caused by copying code from old location with still using some variables of the 'button space' struct. Solved by creating these variables in View3d 'space' as well, and using these instead. Could also remove old coder /* comment */ that there was a unknown bug in the code there. :)