part_type_create() crashes compiled game

Reporter: TheSyrethClan  |  Status: open  |  Last Modified: April 18, 2021, 04:51:37 am
>Describe the bug

Whenever the compiled game runs part_type_create() it crashes, opening a 'xyz.exe has stopped working' window.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create an object.
  2. Assign a part_type_create() to a variable, optionally other things.
  3. Compile and run.

Parse & Compiler Bugs

Here's the EML code for the test project I have created.
Object create code:

part_sys = part_system_create();
part_em = part_emitter_create(part_sys);
part = part_type_create();

part_type_sprite(part, Sp_0, 0, 0, 0);
part_type_gravity(part,0.05,90);

Object Space Key Press code:

part_emitter_burst(part_sys,part_em,part,10);

Crashes

The gbd backtrace log.

Starting program: C:\msys64\tmp\egm1303431095958538578.exe
[New Thread 9628.0xe9c]
[New Thread 9628.0x1234]
[New Thread 9628.0xec]
[New Thread 9628.0x1aa0]
[New Thread 9628.0x2520]
[New Thread 9628.0x24b4]
[Thread 9628.0x2520 exited with code 0]
[Thread 9628.0x24b4 exited with code 0]
[New Thread 9628.0x24e8]
[Thread 9628.0x1aa0 exited with code 0]
[New Thread 9628.0xa18]
[New Thread 9628.0x24ec]
[New Thread 9628.0x247c]
[New Thread 9628.0xc4c]
[New Thread 9628.0x248c]
warning: onecore\com\combase\objact\objact.cxx(834)\combase.dll!00007FF800868CC7: (caller: 00007FF800868046) ReturnHr(1) tid(8d4) 800401F0 CoInitialize has not been called.
[New Thread 9628.0x1e00]
[New Thread 9628.0x1e5c]

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff787318394 in std::less<enigma::pt_shape>::operator() (
    this=0x7ff78750e6c0 <enigma::shape_to_sprite>,
    __x=<error reading variable>, __y=@0xece5dfde60: enigma::pt_sh_pixel)
    at C:/msys64/mingw64/include/c++/10.2.0/bits/stl_function.h:386
386           { return __x < __y; }

(gdb) bt

#0  0x00007ff787318394 in std::less<enigma::pt_shape>::operator() (
    this=0x7ff78750e6c0 <enigma::shape_to_sprite>,
    __x=<error reading variable>, __y=@0xece5dfde60: enigma::pt_sh_pixel)
    at C:/msys64/mingw64/include/c++/10.2.0/bits/stl_function.h:386
#1  0x00007ff7873fbe57 in std::_Rb_tree<enigma::pt_shape, std::pair<enigma::pt_shape const, enigma::particle_sprite*>, std::_Select1st<std::pair<enigma::pt_shape const, enigma::particle_sprite*> >, std::less<enigma::pt_shape>, std::allocator<std::pair<enigma::pt_shape const, enigma::particle_sprite*> > >::_M_lower_bound (this=0x7ff78750e6c0 <enigma::shape_to_sprite>, __x=0xfeeefeeefeeefeee,
    __y=0x7ff78750e6c8 <enigma::shape_to_sprite+8>,
    __k=@0xece5dfde60: enigma::pt_sh_pixel)
    at C:/msys64/mingw64/include/c++/10.2.0/bits/stl_tree.h:1935
#2  0x00007ff7873fc2b1 in std::_Rb_tree<enigma::pt_shape, std::pair<enigma::pt_shape const, enigma::particle_sprite*>, std::_Select1st<std::pair<enigma::pt_shape const, enigma::particle_sprite*> >, std::less<enigma::pt_shape>, std::allocator<std::pair<enigma::pt_shape const, enigma::particle_sprite*> > >::find (
    this=0x7ff78750e6c0 <enigma::shape_to_sprite>,
    __k=@0xece5dfde60: enigma::pt_sh_pixel)
    at C:/msys64/mingw64/include/c++/10.2.0/bits/stl_tree.h:2553
#3  0x00007ff7873b7810 in std::map<enigma::pt_shape, enigma::particle_sprite*, std::less<enigma::pt_shape>, std::allocator<std::pair<enigma::pt_shape const, enigma::particle_sprite*> > >::find (
    this=0x7ff78750e6c0 <enigma::shape_to_sprite>,
    __x=@0xece5dfde60: enigma::pt_sh_pixel)
    at C:/msys64/mingw64/include/c++/10.2.0/bits/stl_map.h:1170
#4  0x00007ff78726a30e in enigma::get_particle_sprite (
    particle_shape=enigma::pt_sh_pixel)
    at Universal_System/Extensions/ParticleSystems/PS_particle_sprites.cpp:940
#5  0x00007ff78726e818 in enigma::initialize_particle_type (pt=0x232b9705900)
    at Universal_System/Extensions/ParticleSystems/PS_particle_type.cpp:53
#6  0x00007ff78726eb63 in enigma_user::part_type_create ()
    at Universal_System/Extensions/ParticleSystems/PS_particle_type.cpp:105
#7  0x00007ff7871c3e7c in enigma::OBJ_O_0::myevent_create (this=0x232b9704380)
    at C:/Users/Confidential/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:47
#8  0x00007ff7872337e5 in enigma::roomstruct::gotome (
    this=0x7ff787507ae0 <enigma::grd_rooms>, gamestart=true)
    at Universal_System/roomsystem.cpp:276
#9  0x00007ff7872378b0 in enigma::game_start ()
    at Universal_System/roomsystem.cpp:885
#10 0x00007ff787244aeb in enigma::initialize_everything ()
    at Universal_System/Resources/loading.cpp:128
#11 0x00007ff7871c730b in enigma::enigma_main (argc=1, argv=0x232b7e560d0)
    at Platforms/General/PFmain.cpp:85
#12 0x00007ff7871cd9c7 in WinMain (hInstance=0x7ff7871c0000,
    hPrevInstance=0x0, lpCmdLine=0x232b7cc45eb "", iCmdShow=10)
    at Platforms/Win32/WINDOWSmain.cpp:460
#13 0x00007ff787445992 in main (flags=<optimized out>,
    cmdline=<optimized out>, inst=<optimized out>)
    at C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18
#14 0x00007ff7871c13c1 in __tmainCRTStartup ()
    at C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:321
#15 0x00007ff7871c14f6 in mainCRTStartup ()
    at C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:202
(gdb)

Expected behavior

Particles being created (with the sprite in question and a bit of gravity).

Game files & Screenshots

N/A

ENIGMA Configuration:

  • Windows 64-bit
  • Build > ENIGMA > API config:
  • Compiler Mingw GCC G++
  • Platform: Windows
  • Graphics: OpenGL 1.1 / OpenGL 3.3 / Direct3D 9
  • Audio: DirectSound
  • Collision: Precise
  • Widgets: Windows Widgets
  • Networking: None
  • <
Please sign in to post comments, or you can view this issue on GitHub.