1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

Windows Surface error when checking existance

Discussion in 'Programming' started by 66Gramms, Jul 30, 2017.

  1. 66Gramms

    66Gramms Member

    Joined:
    Feb 2, 2017
    Posts:
    23
    Hello!
    I'm quite a beginner with surfaces and some why when i want to destroy at the end of the game i get a fatal error for the line where i check it.

    Error message:
    Code:
     
    ___________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Other Event: Game End
    for object cont_tracks:
    
    Variable cont_tracks.surftmp(100021, -2147483648) not set before reading it.
     at gml_Object_cont_tracks_EndGameEvent_1 (line 5) - } if (surface_exists(surftmp))  //Memory leak megszüntetése
    ############################################################################################
    
    Here is the content of the event (it's a game end event):
    Code:
    ///Destroy the surface
    if (surface_exists(surface_track))  //Memory leak megszüntetése
    {
        surface_free(surface_track);
    } if (surface_exists(surftmp))  //Memory leak megszüntetése
    {
        surface_free(surftmp);
    }
    I have no idea how can this happen as this is just an if statement... I guess I miss something but please help me about what is that thing? Thank you in advance!
     
  2. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,262
    Is surftmp ever mentioned in the create event? It only has to be a declared variable for it to not crash it doesn't even have to be declared as a surface.
     
    66Gramms likes this.
  3. 66Gramms

    66Gramms Member

    Joined:
    Feb 2, 2017
    Posts:
    23
    Lol... thanks xd I knew i missed something obvious
     

Share This Page