SFML community forums

Help => Graphics => Topic started by: caudate_julie on July 03, 2017, 02:35:55 am

Title: Bug: Texture crashes at destructor.
Post by: caudate_julie on July 03, 2017, 02:35:55 am
#include <SFML/Graphics.hpp>

int WinMain()
{
        sf::RenderTexture t;
        t.create(50, 50);
        return 0;
}

Once in 5-10 runs this program crashes with access violation (both dynamic & static linking).

Backtrace:

     ig4icd64.dll!00007ff9e54d6cfd()    Unknown
     ig4icd64.dll!00007ff9e57b5e0b()    Unknown
     ig4icd64.dll!00007ff9e54e626c()    Unknown
     ig4icd64.dll!00007ff9e53e73fc()    Unknown
     ig4icd64.dll!00007ff9e53e71f6()    Unknown
     ig4icd64.dll!00007ff9e53bac9a()    Unknown
     Graphics.exe!sf::Texture::~Texture() Line 104      C++
     Graphics.exe!sf::RenderTexture::~RenderTexture() Line 48   C++
>    Graphics.exe!WinMain() Line 7      C++
     Graphics.exe!__tmainCRTStartup() Line 528  C
     Graphics.exe!WinMainCRTStartup() Line 377  C
     kernel32.dll!00007ffa15668364()    Unknown
     ntdll.dll!00007ffa15f670d1()       Unknown

Output:

'Graphics.exe' (Win32): Loaded 'D:\Programming\C++\Graphics\x64\Debug\Graphics.exe'. Symbols loaded.
'Graphics.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
[...also for a bunch of system files]

First-chance exception at 0x00007FF9E54D6CFD (ig4icd64.dll) in Graphics.exe: 0xC0000005: Access violation reading location 0x00000248C4035770.
Unhandled exception at 0x00007FF9E54D6CFD (ig4icd64.dll) in Graphics.exe: 0xC0000005: Access violation reading location 0x00000248C4035770.

System:

Windows 10 64-bit, Visual Studio 2012, Microsoft C/C++ Optimizing Compiler Version 17.00.61030 for x86.
SFML-2.4.2


Some more notes on strange behavior. There are two classes in the project. Both contain sf::RenderTexture field (different textures) and create it in constructor. One crashes at destructor, other doesn't, but both when destructor is called write warning to output (two flavors appear at random with several consecutive calls):

Debug Assertion Failed!

Program: C:\WINDOWS\SYSTEM32\MSVCP110D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector
Line: 240

Expression: vector iterators incompatible

Debug Assertion Failed!

Program: C:\WINDOWS\SYSTEM32\MSVCP110D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector
Line: 101

Expression: vector iterator not incrementable