EXC_BAD_ACCESS when I close my window, which is also my application's delegate

前端 未结 3 528
醉梦人生
醉梦人生 2021-01-16 20:48

I wrote a Cocoa Application and I got EXC_BAD_ACCESS error when I\'m closing an application window. I read that this error usually means problems with memory, b

3条回答
  •  一个人的身影
    2021-01-16 21:05

    The crash is caused by the fact that you made the window your application's delegate. When you close the window, that is the last release that kills it off, and if it's the last window you had up, it causes the application to ask its delegate whether it should quit. Since the window you just killed off is the application's delegate, you get that crash.

    Longer explanation and suggestion of solution in my answer on your subsequent question.

提交回复
热议问题