Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does this crash?
#10
Unfortunately it's just a pretty straight forward bug in QB64, you can see it here.

Basically what's happening is that the program starts with a buffer that can hold 4096 images, and once you create more than that it will "resize" the buffer to be larger by another 4096. That resize process involves creating a new buffer, copying the contents, and then freeing the previous buffer. The code does attempt to update the pointers to images, hence the `update existing img pointers to new locations` comment, but unfortunately that's not good enough because the display thread is using `display_page` with no synchronization. The end result is that the display thread can end up reading from `display_page` when it still points to the old free'd buffer of images and that leads to it randomly blowing up.

I can't offer an actual fix at the moment beyond just avoiding that many images, but if you change `IMG_BUFFERSIZE` in `libqb.cpp` to be larger than the number of images your program will use then you can avoid the issue.
Reply


Messages In This Thread
Why does this crash? - by TerryRitchie - 09-18-2023, 09:43 PM
RE: Why does this crash? - by GareBear - 09-18-2023, 10:01 PM
RE: Why does this crash? - by Dav - 09-18-2023, 10:08 PM
RE: Why does this crash? - by TerryRitchie - 09-18-2023, 10:33 PM
RE: Why does this crash? - by TerryRitchie - 09-18-2023, 10:42 PM
RE: Why does this crash? - by TerryRitchie - 09-18-2023, 10:50 PM
RE: Why does this crash? - by mnrvovrfc - 09-18-2023, 11:01 PM
RE: Why does this crash? - by Dav - 09-18-2023, 11:04 PM
RE: Why does this crash? - by mnrvovrfc - 09-18-2023, 11:12 PM
RE: Why does this crash? - by DSMan195276 - 09-19-2023, 12:22 AM
RE: Why does this crash? - by SMcNeill - 09-19-2023, 12:42 AM
RE: Why does this crash? - by bplus - 09-19-2023, 12:43 AM
RE: Why does this crash? - by DSMan195276 - 09-19-2023, 12:47 AM
RE: Why does this crash? - by SMcNeill - 09-19-2023, 12:56 AM
RE: Why does this crash? - by SMcNeill - 09-19-2023, 12:53 AM
RE: Why does this crash? - by DSMan195276 - 09-19-2023, 02:23 AM
RE: Why does this crash? - by TerryRitchie - 09-19-2023, 03:22 AM
RE: Why does this crash? - by bplus - 09-20-2023, 10:09 AM
RE: Why does this crash? - by TerryRitchie - 09-20-2023, 02:21 PM
RE: Why does this crash? - by TerryRitchie - 09-20-2023, 02:44 AM
RE: Why does this crash? - by bplus - 09-20-2023, 02:37 PM
RE: Why does this crash? - by TerryRitchie - 09-20-2023, 05:17 PM



Users browsing this thread: 2 Guest(s)