Objective-C++でEXC_BAD_ACCESS
をデバッグしていて、良いSOの学生のように、NSZombieEnabled
という環境変数をYES
に設定しました。ゾンビはObjective-C++に役立つのですか?
私はゾンビを取得していませんが、ログにはただ(gdb)
、次にEXC_BAD_ACCESS
は私のコードのさまざまな行にあります。
質問:私はZombiesを間違って使用していますか、または私のプロジェクトのC++部分を無視していますか?
例:
if (this->squares[i][j] == 1) // <-- EXC_BAD_ACCESS on this line. The array exists and shows up in the debugger... and i and j both exist and are 0.
スタック:あなたは割り当て解除されたオブジェクトにメッセージを送信するとき、彼らは、デバッガ内のフラグをするので
Thread 1, Queue : com.apple.main-thread
#0 0x00009309 in Board::draw(float, float, float, float, float) at /Developer/of_007_iphone/apps/cwi007/iTicTacToe/src/gameplay/gameBoard.cpp:53
#1 0x0000a2f1 in SuperBoard::drawBig(float, float, float)()
#2 0x000044b8 in testApp::draw()()
#3 0x0020fc16 in ofAppiPhoneWindow::timerLoop()()
#4 0x00218db9 in -[ofxiPhoneAppDelegate timerLoop]()
#5 0x00ab1749 in __NSFireTimer()
#6 0x01f898c3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__()
#7 0x01f8ae74 in __CFRunLoopDoTimer()
#8 0x01ee72c9 in __CFRunLoopRun()
#9 0x01ee6840 in CFRunLoopRunSpecific()
#10 0x01ee6761 in CFRunLoopRunInMode()
#11 0x027651c4 in GSEventRunModal()
#12 0x02765289 in GSEventRun()
#13 0x00d29c93 in UIApplicationMain()
#14 0x002106e1 in ofAppiPhoneWindow::runAppViaInfiniteLoop(ofBaseApp*)()
#15 0x002219ae in ofRunApp(ofBaseApp*)()
#16 0x00002fd6 in main()
ゾンビは唯一のObjective-Cのオブジェクトのために働くとあなたがそれらをoverreleaseしている場合、それらにメッセージを送信します。この場合、他の何かが間違っています。関連するコードを表示できますか? – 0xSina
@Pragramはい!しかし、別の質問、私はここでそれを求めている:http://stackoverflow.com/questions/7387988/class-draw-method-works-when-called-directly-but-crashes-when-called-by-anothe – buildsucceeded