← Back to team overview

leaningtech-dev team mailing list archive

[Bug 1644017] [NEW] Using std::map in functions the second time crashes

 

Public bug reported:

I am having a very large problem.

I have a map which is identified with "std::map<string,string (*)(string,vector<string>)>".
The map contains a name of the function that maps to the actual function.
I have to make several calls to this map. The map is in global scope.

One of my functions contains an std::map<string,string>. The map
executes correctly if ran the first time, however, the second time it
executes a function it errors out: "Uncaught TypeError: Cannot read
property 'a0' of undefined" . I manage to find the cause of the problem
and it seems to be including any type of std::map in a function. If I
remove the std::map it executes fully and correctly. If I add it to any
other function that is also has a pointer from "std::map<string,string
(*)(string,vector<string>)>". it gives me an error on second execution.
So for now, I am using vectors which seem to work. However, I would
really love to use std::map<string,string> for several of my functions.
Again, it executes once, but fails to execute second time. Perhaps this
is due to Cheerp Preprocesser optimizing the std::map that executes
first time and then after it completes the execution, the second time,
it somehow tries to overwrite that object?

I am not sure, but it would be great if it gets fixed.

** Affects: cheerp
     Importance: Undecided
         Status: New


** Tags: call error map second

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Cheerp.
https://bugs.launchpad.net/bugs/1644017

Title:
  Using std::map in functions the second time crashes

Status in Cheerp:
  New

Bug description:
  I am having a very large problem.

  I have a map which is identified with "std::map<string,string (*)(string,vector<string>)>".
  The map contains a name of the function that maps to the actual function.
  I have to make several calls to this map. The map is in global scope.

  One of my functions contains an std::map<string,string>. The map
  executes correctly if ran the first time, however, the second time it
  executes a function it errors out: "Uncaught TypeError: Cannot read
  property 'a0' of undefined" . I manage to find the cause of the
  problem and it seems to be including any type of std::map in a
  function. If I remove the std::map it executes fully and correctly. If
  I add it to any other function that is also has a pointer from
  "std::map<string,string (*)(string,vector<string>)>". it gives me an
  error on second execution. So for now, I am using vectors which seem
  to work. However, I would really love to use std::map<string,string>
  for several of my functions. Again, it executes once, but fails to
  execute second time. Perhaps this is due to Cheerp Preprocesser
  optimizing the std::map that executes first time and then after it
  completes the execution, the second time, it somehow tries to
  overwrite that object?

  I am not sure, but it would be great if it gets fixed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cheerp/+bug/1644017/+subscriptions


Follow ups