A list for the developers of CellML tools

Text archives Help


[cellml-dev] pure virtual function call in telicems


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-dev] pure virtual function call in telicems
  • Date: Wed, 05 Jan 2011 08:22:04 +1300

On 01/01/11 09:59, Lucian Smith wrote:
> So, I'm getting the error:
>
> pure virtual method called
> terminate called without an active exception
>
> from the line:
>
> RETURN_INTO_OBJREF(math, iface::mathml_dom::MathMLElement,
> tmr->mathResult());
>
> My code is a slight variation of the code you wrote me, since the
> signatures of the functions had changed slightly, but I didn't change that
> one line. The new code now reads:
>
> bool Module::AddCellMLMathTo(string formula, Variable* targetvar,
> iface::dom::Document* doc)
> {
> RETURN_INTO_OBJREF(cmlvar, iface::cellml_api::CellMLVariable,
> targetvar->GetCellMLVariable());
> RETURN_INTO_OBJREF(cmlcomp, iface::cellml_api::CellMLComponent,
> GetCellMLComponentOf(cmlvar));
> return AddCellMLMathTo(formula, cmlcomp, doc);
> }
> bool Module::AddCellMLMathTo(std::string formula,
> iface::cellml_api::CellMLComponent* cmlcomp, iface::dom::Document* doc)
> {
> RETURN_INTO_OBJREF(ts, iface::cellml_services::TeLICeMService,
> CreateTeLICeMService());
> std::wstring wform(makeUTF16(formula));
> RETURN_INTO_OBJREF(tmr, iface::cellml_services::TeLICeMMathResult,
> ts->parseMaths(doc, wform.c_str()));
> // XXX it would be good to check tmr->errorMessage() and log the error -
> Andrew Miller
> RETURN_INTO_OBJREF(math, iface::mathml_dom::MathMLElement,
> tmr->mathResult());
> if (math == NULL)
> return false;
> cmlcomp->addMath(math);
> return true;
> }
>
> So, it looks to me like the parsing of the formula into tmr worked fine,
> and now it's just a question of retrieving the MathMLElement from it.
>
> If I'm understanding the code correctly, I think this means that there
> might be code in the CellML API that either hasn't been exposed in my
> version, or that hasn't been written. Is that right, or do I need to do
> something else?

Hi Lucian,

I built your code from the Subversion repository below and ran it
through valgrind - but it looks like the problem occurs because you are
releasing the object and then trying to use it after it has been
released (which is invalid). Based on your next message, it is possible
you already worked this out - it would be good to see your version of
the code with it fixed (so it runs without giving any errors in
valgrind, for example), to see if the other problem you reported still
happens.

Best wishes,
Andrew

>
> If you want to look at my new code, don't go to sourceforge--that's for
> guaranteed-working release versions. The
> my-working-version-that-may-or-may-not-work is at:
>
> svn://sys-bio.org/SVN/antimony/
>
>




  • [cellml-dev] pure virtual function call in telicems, Andrew Miller, 01/05/2011

Archive powered by MHonArc 2.6.18.

Top of page