我的守则是:
typedef struct TItemSelector{
ItemSelectFrame* pItems[2];
} SItemSelector;
class item {
public:
void expMethod();
SItemSelector itemSelector_;
UILayerButton* startBtn_;
};
void item::expMethod(){
startBtn_ = new UILayerButton();
for (i = 0; i < 3; i++) {
itemSelector_.pItems[i] = new ItemSelectFrame();
}
startBtn_->callMethodA();
}
void UILayerButton::callMethodA()
{
this->callMethodB();
}
void UILayerButton::callMethodB()
{
}
On this->callMethodB();
, a "EXC_BAD_ACCESS" occoured.
之后,我找到了工作:
class item {
public:
void expMethod();
SItemSelector itemSelector_;
SItemSelector itemSelector2_; // work around
UILayerButton* startBtn_;
};
那么,一切都好了......。 我只不知道发生了什么,但<条码>电话:MethodB()只是一种空洞的方法,与它毫无关系。
I m 采用Amplus LLVM 3.1,设定违约。
UPDATE: 确定我的代码。