Calling DirichletBC.set_value() in a function causes segfault

Issue #22 resolved
Gabriel Balaban created an issue

Running the script below with dolfin 1.2.0 causes the error "Segmentation fault (core dumped)" to appear. If however the two lines under "this works" are commented back in the code works.

from dolfin import *

def update_BC(bc_to_update, value): new_value = project(value, bc_to_update.function_space()) bc_to_update.set_value(new_value)

mesh = UnitSquareMesh(2,2) V = FunctionSpace(mesh, "CG",1)

uflexp = triangle.x[0] bc = DirichletBC(V , uflexp, "on_boundary")

#Doing this causes a crash update_BC(bc, uflexp)

#Doing this works #new_value = project(uflexp, bc.function_space()) #bc.set_value(new_value)

print bc.get_boundary_values().values()

Comments (2)

  1. Johan Hake

    This is becaused the passed new_value is garbage collected in the update_bc function. I have fixed this in master.

    Johan

  2. Log in to comment