Bonjour , je suis nouveau sur le forum ^^ et un peu nouveau a la SDL 2 , bref
Je travaille sur un petit projet de console virtuelle , et ma fonction de rendu ne marche pas , apres avoir mis des std::cout partout et utilisé le debugger , il trouve une "segmentation fault" (donc acces a une zone memoire non allouée) lors du SDL_CreateTextureFromSurface :
et voici les appels de stack du bebegger :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 void Fenetre::ActualiserEcran() { std::cout << "Deb. ActualiserEcran()"; SDL_Rect rectangle_dest = {0, 0, (TAILLE_FENETRE*RATIO_ECRAN_L), (TAILLE_FENETRE*RATIO_ECRAN_H)}; const unsigned int nbBytesInAPixelRow = ((TAILLE_FENETRE*RATIO_ECRAN_L)*3)*8; std::cout << "Bp 2"; SDL_Surface *ecran_rendu = SDL_CreateRGBSurfaceFrom(&m_ecran_brut, (TAILLE_FENETRE*RATIO_ECRAN_L), (TAILLE_FENETRE*RATIO_ECRAN_H),32, nbBytesInAPixelRow, 0, 0, 0, 0); if(ecran_rendu == nullptr) { std::cout << SDL_GetError(); } std::cout << "Bp 2.5 "; SDL_Texture *texture_a_coller_ecran = SDL_CreateTextureFromSurface(m_renderer, ecran_rendu); if(texture_a_coller_ecran = nullptr) { std::cout << SDL_GetError(); } std::cout << "Bp3"; if(SDL_RenderCopy(m_renderer, texture_a_coller_ecran, nullptr, &rectangle_dest) != 0) { std::cout << SDL_GetError(); }; SDL_RenderPresent(m_renderer); std::cout << "Bp4"; SDL_DestroyTexture(texture_a_coller_ecran); // Desallocations SDL_FreeSurface(ecran_rendu); }
#0 0x6c7a3d7c Blit4to4MaskAlpha(info=0x6fd0058) (../src/video/SDL_blit_N.c:2055) <--- ce qui crée la Segfault
#1 0x6c7963e8 SDL_SoftBlit(src=0xa68660, srcrect=0x611440, dst=0x70ceea8, dstrect=0x611440) (../src/video/SDL_blit.c:88)
#2 0x6c7c32ac SDL_ConvertSurface(surface=0xa68660, format=0x70cee60, flags=0) (../src/video/SDL_surface.c:832)
#3 0x6c7708da SDL_CreateTextureFromSurface(renderer=0xa67900, surface=0xa68660) (../src/render/SDL_render.c:503)
#4 0x401866 Fenetre::ActualiserEcran(this=0x6115cc) (C:\Users\Antoine\Desktop\Virtual Game Support Project\src\fenetre .cpp:118)
#5 0x402898 SDL_main(argc=1, argv=0xa61100) (C:\Users\Antoine\Desktop\Virtual Game Support Project\src\main.cpp:37)
#6 0x4036d7 console_main(argc=1, argv=0xa61100) (../src/main/windows/SDL_windows_main.c:138)
#7 0x40375f WinMain@16(hInst=0x400000, hPrev=0x0, szCmdLine=0xa839b5 "", sw=10) (../src/main/windows/SDL_windows_main.c:175)
#8 0x46cc4b main () (???)
Votre aide est la bienvenue
Partager