|
Bad File Descriptor |
Scooter
Member #16,799
January 2018
|
Hi all: Thanks for your time! |
Edgar Reynaldo
Major Reynaldo
May 2007
|
We can't guess what you're doing. Show some code, like where you load your textures, any init code, etc... My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Scooter
Member #16,799
January 2018
|
Hi Edgar: These are both done in Ubuntu Linux in Allegro5 using codeblocks compiler. I get the same results using MX Linux 19.4. I quit using Allegro because of this problem, but now it shows the I checked the Internet and found this problem occurs in many programs. Be interesting to see what you find out. I really need to use Allegro5 As always, thanks for your time. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Scooter - please explain a little more by what you mean when the files display "Bad File Descriptor". When does that happen? During compilation? During al_load_bitmap? During display code? You could try saving your files as UTF-8 in code blocks and see if that fixes it. I'm not sure where the error is coming from, as you say your first c file compiles and displays perfectly. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Scooter
Member #16,799
January 2018
|
Hi Edgar: |
Edgar Reynaldo
Major Reynaldo
May 2007
|
It sort of works on Windows. No mention of any 'bad file descriptor' message. After fixing your includes and making it use OpenGL, cube.c displayed perfectly and ran fine. No compilation warnings or errors. cubeX.c (after the same fixes) displayed only 4 of the 6 colors, but otherwise ran fine. I haven't tried it on Linux yet, but I will shortly. It should be noted that you're both leaking memory and have dangling pointers. You overwrite the value of bmp without storing the old value to destroy later. Also, you shouldn't be calling glDeleteTextures, but rather al_destroy_bitmap. What's more, you haven't checked ANY return values to see if anything fails. Start there, save the file as UTF-8 and get back to me. UPDATE My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Scooter
Member #16,799
January 2018
|
Hi Edgar; By the way, what is wrong with this site? I had to post this twice. The Anyway, Have a great day. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
This site is old and neglected. Talk to Matthew about it. ;/ Don't call glDeleteTextures. Allegro will take care of the textures by itself when the bitmap is destroyed. Allegro also destroys all bitmaps when the last display is destroyed. You can manually de-allocate the bitmaps using al_destroy_bitmap. This is where the memory leak is coming from. I was incorrect about dangling pointers. Look at this example : ALLEGRO_BITMAP* bmp = al_load_bitmap("green.jpg"); bmp = al_load_bitmap("blue.jpg"); The first value stored in the 'bmp' variable is overwritten and lost, hence the memory leak. If allegro wasn't tracking it in the background anyway. I think the real problem is that you're calling glDeleteTextures. It means allegro will also try to destroy the textures when the display is destroyed. This is a double free, and leads to memory corruption. UPDATE APPEND My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Scooter
Member #16,799
January 2018
|
Hi Edgar: Have a great day! |
|