FunctionAXPY should store Function as std::shared<Function> instead of Function*

Issue #688 resolved
Chaffra Affouda created an issue

When creating FunctionAXPY from python this creates a seg fault if the Function is not stored.

class MyClass:
  def my_function(self):
      f = Function(Q)
      self.axpy = FunctionAXPY([1.0,f])

  def my_other_function(self):
     #this will seg fault unless you save f above with self._f = f
     self.axpy.call_something_that_uses_pointer_to_stored_function()

Comments (4)

  1. Jan Blechta

    Issue solved for FunctionAXPY interface by 24ac0fa.

    For FunctionAXPY Function::operator[+-*/] the issue is unfixable in principle - one cannot pass in shared ptr version of this.

  2. Log in to comment