Fix crash closing Blender while in rendered local view
Happens because it was always using regionbase of active/visible area, not the correct one of the (possibly inactive) 3D view. Was pretty hidden because you had to be in local view to trigger it. Could also remove ScrArea * argument from SpaceType.id_remap now, but leaving in there to avoid bigger changes (might also be useful for some case). Steps to reproduce: * Default startup.blend * Enter local view with default cube (/-key) * Render (or open a different editor where the 3D View is) * Close Blender - should invoke crash
This commit is contained in:
		@@ -1400,7 +1400,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 | 
			
		||||
	return -1; /* found but not available */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void view3d_id_remap(ScrArea *sa, SpaceLink *slink, ID *old_id, ID *new_id)
 | 
			
		||||
static void view3d_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
 | 
			
		||||
{
 | 
			
		||||
	View3D *v3d;
 | 
			
		||||
	ARegion *ar;
 | 
			
		||||
@@ -1414,7 +1414,8 @@ static void view3d_id_remap(ScrArea *sa, SpaceLink *slink, ID *old_id, ID *new_i
 | 
			
		||||
		if ((ID *)v3d->camera == old_id) {
 | 
			
		||||
			v3d->camera = (Object *)new_id;
 | 
			
		||||
			if (!new_id) {
 | 
			
		||||
				for (ar = sa->regionbase.first; ar; ar = ar->next) {
 | 
			
		||||
				/* use v3d->regionbase as sa->regionbase is from active area, 3D view might be inactive though */
 | 
			
		||||
				for (ar = v3d->regionbase.first; ar; ar = ar->next) {
 | 
			
		||||
					if (ar->regiontype == RGN_TYPE_WINDOW) {
 | 
			
		||||
						RegionView3D *rv3d = is_local ? ((RegionView3D *)ar->regiondata)->localvd : ar->regiondata;
 | 
			
		||||
						if (rv3d && (rv3d->persp == RV3D_CAMOB)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user