Segmentation fault is one of the hardest to fix errors. You only showed some lines of code and that is not enough for us to inspect the problem. Can you provide us the whole source code? If you're not willing to publicize the whole project, you can write a demo project that showing that issue.
Create a new folder, copy and paste all the necessary files to there except: the binary (exe file), *.bak, lib and backup folders. Compress the folder and send the zip here.
Generally these things can cause a segmentation error:
- Calling a method of an uninitialized or nil object
- Freeing an object that has not been initialized
- Pointer points to wrong memory location
- Trying to read memory location that is prohibited
- Writing to memory location that has not been allocated