构建后立即调用类析构函数时,Android ARM程序崩溃

时间:2014-01-07 23:42:57

标签: android c++ crash alignment native

我有一个包含许多方法和数据项的大类。在WindowsLinux上投放时,我没有问题。 Windows上的净化不会报告任何问题。但是在Android(ARM)上,程序崩溃了这些简单的代码行:

CDrawGL *pDrawGL = new CDrawGL; // this success..  
delete pDrawGL; // crashes here..  

CDrawGL.h& CDrawGL.cpp位于另一个文件中。

我直接在这个文件中包含了类CDrawGL头和方法,创建了一个新的类CDrawNewGL,这段代码不会崩溃:

CDrawNewGL *pDrawGL = new CDrawNewGL; // this success..  
delete pDrawNewGL; // as does this..  

构造函数不会调用任何其他方法,而是简单地初始化一些简单(无数组)变量。析构函数测试简单变量以查看是否需要“删除”(它没有)。该类确实包含std :: vector<<双* GT;>和std :: vector<<浮动>>,两者都不被访问。

还有其他人遇到过这种崩溃吗?

感谢。

更新

如果我只是在主代码中“包含”类的头部和主体,则简单构造然后破坏工作(但稍后在程序中失败)。必须有一些东西抛弃对齐。

#include "CDrawGL.h"  
#include "CDrawGL.cpp"  // <<-- added this  

..main program..

CDrawGL *pDrawGL = new CDrawGL;  // this works..  
delete pDrawGL;  // this now works.. 
pDrawGL = new CDrawGL;  

....

pDrawGL->Draw();  // now crashes (fails) down in library

0 个答案:

没有答案
相关问题