Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICallback::Clone() fails to set parent #3

Closed
GoogleCodeExporter opened this issue Mar 22, 2015 · 2 comments
Closed

ICallback::Clone() fails to set parent #3

GoogleCodeExporter opened this issue Mar 22, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Compile example
2. Use any function which calls GetParent (e.g. "list_fun()")
3. Observe assertion error on m_pParent == NULL


What is the expected output? What do you see instead?

List of functions, see above.


What version of the product are you using? On what operating system?

Linux ntjk 2.6.37.6-0.9-desktop #1 SMP PREEMPT 2011-10-19 22:33:27 +0200 x86_64 
x86_64 x86_64 GNU/Linux
muParserX 2.1.0

Please provide any additional information below.

Can be fixed by making GetParent a const function and using 
SetParent(GetParent()) in Clone() on cloned instance first; tested, solves the 
problem, function works as intended.

Original issue reported on code.google.com by jkori...@gmx.net on 17 Jan 2012 at 7:51

@GoogleCodeExporter
Copy link
Author

The defect is in the example.cpp file. I forgot to update the function 
definitions there when i changed it in the rest of the code. Instead of using 
parameterless contructors Clone should invoke the copy constructor.

virtual IToken* Clone() const
{
  return new FunListFunctions(*this);
}

I Fixed the sample code, the rest of the codebase was already doing it right.

Original comment by ib...@gmx.info on 17 Jan 2012 at 8:58

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by ib...@gmx.info on 17 Jan 2012 at 8:59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant