BlockMatrix and deleted matrices
Bug #702372 reported by
Joachim Haga
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DOLFIN |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The following code crashes, unless "del A" is commented out. I don't know the memory handling strategy in dolfin, (boost::shared_ptr is used in some places, but not consistently?) but attached is a patch which at least removes the crash by making private copies of the matrices (and vectors in BlockVectors).
from dolfin import *
mesh = UnitSquare(4, 4)
V = FunctionSpace(mesh, "CG", 1)
u,v = TrialFunction(V), TestFunction(V)
a = u*v*dx
AA = BlockMatrix(1,1)
A = assemble(a)
AA[0, 0] = A
del A
print AA[0,0]
Related branches
Changed in dolfin: | |
milestone: | none → 0.9.10 |
Changed in dolfin: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The most robust solution would be to have BlockFoo use smart pointers.