C ++调用了错误的函数

| 我有一个奇怪的错误,其中C ++调用了错误的函数: 因此,这段代码被调用:
  class FmeGrid
  {  
     // ....
     virtual void saveGridParameters() const;
     virtual void setCellSignalValue(int row, int col, double double_value, const std::string& string_value);
     // ....
  }

  void EnfClientFrame::saveGridParameters()
  {
    this->grid->saveGridParameters();
  }
堆栈中的下一个函数是:
  void FmeGrid::setCellSignalValue(int row, int col, double double_value, const std::string& string_value)
  {
    this->setCellString(row, col, string_value, wxALIGN_RIGHT);
    this->setCellBackground(row, col, GetSignalColour(double_value));
  }
具有完全随机的值,这是堆栈:
enf_client.exe!ui::FmeGrid::setCellSignalValue(int row=1239452, int col=1239236, double double_value=-9.2559592117431994e+061, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & string_value={...})  Line 468 + 0x23 bytes  C++
enf_client.exe!ui::EnfClientFrame::saveGridParameters()  Line 170 + 0x20 bytes  C++
因此,“ grid \”指针指向一个从FmeGrid(仅从FmeGrid)继承的类。 saveGridParameters是一个虚函数,因此可能是因为这个原因。     
已邀请:
        最常见的原因是: 肮脏的构建(即更改了接口,但未重建使用这些接口的对象) 堆栈损坏(您重写了堆栈中的某些内容,这些内容导致调用了错误的函数和/或使用无效参数的正确函数) 尝试使用干净的重建进行修复,如果仍然发生,请尝试使用内存调试工具(如Valgrind)查看覆盖堆栈的位置。     
        要添加到@brandx答案: this-> grid-> saveGridParameters()已由编译器内联,并直接或间接(通过其他内联函数)调用ui :: FmeGrid :: setCellSignalValue。     

要回复问题请先登录注册