0
votes

I have been working on a pygame project for a while now and started making the intro screens.

Running the game and going through the intro screens works fine, but when I reach the main_loop() the game starts but quickly crashes afterwards.

I had no problems with the main_loop() before this and was at a point I could go from intro_loop() to main_loop() and it worked, Its after I added story_screen_1() that now the main_loop() crashes with this error:

Error Message

/usr/local/bin/python3 "/Users/brucepouncey/Game_0/venv/Game_0_MASTERcopy.py"
Python(1323,0x101931380) malloc: *** error for object 0x1040b64f0:pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

So I back-tracked and removed everything I had implemented, back to the point that it was working.

But the same error occured and now my main_loop() isnt even running even when its alone, I get the same error.

Iv been over my code numerous times removing and moving things around and still no luck.

I can usually pinpoint an error through its message but this one is a first. If I can know what this error message means I will hopefully be able to find the source of the bug.

Alot of answers iv searched for are related to C languages and Im not familiar with them.

1
Something has gone horribly wrong, and this is almost certainly not your fault. Are you using any other libraries? - user2201041
Your code is trying to free a pointer to memory that was never allocated. This probably happened in some library code. To get help in diagnosing here, you will need to find a minimal reproducible example. Isolating the position were the error happens might also help you find the error by yourself and otherwise allows us to help you looking for it. - jotasi
Just Pygame, Time and Random what do you mean horribly wrong? Iv been working on this for like 6 months lol @JETM - Bruce Pouncey
Would re-downloading the libraries I'm using help? I feel something in the backend has gone. I really don't see any out of place syntax and iv even examined it against my master copy I had saved before now neither work. @jotasi - Bruce Pouncey
I didn't say anything about a syntax error. A minimal reproducible example just helps you to narrow down, where exactly the error occurs. The resulting minimal example then allows to determine whether this is actually a bug in PyGame as @JETM suggested or something else is going wrong. - jotasi

1 Answers

0
votes

I did what you said and isolated the location of the problem. I rebuilt the program class for class, method for method, import for import until the bug occurred. It was in my game over sprites, I think a music file, which was located in game_main_loop(). I removed them and created a new game_over_loop() and put them in their instead and all seems to be working fine now.