If it crashes, post a crash address. If I know what instruction it crashes at, I can check to see why. It'll either be listed as an instruction address, or perhaps the value of EIP in a detailed crash report.
Also, I assume there is other code in your project. Are you sure this is the code that is causing the crash?