Author Topic: Callback Segmentation Fault  (Read 83 times)

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 128
    • View Profile
    • Github Repositories
Callback Segmentation Fault
« on: November 15, 2020, 09:53:25 AM »
I'm getting a segmentation fault when I use the check_key callback in a layout. I'm assuming it's because I'm calling other functions and objects from the callback, but not doing it correctly.

I'll look at some other layouts later to maybe learn a thing or two, but for now I need a break.  ;D Any suggestions would be appreciated.

Code: [Select]

local key = config['key'];
local slide_time = "350ms";

local key_delay = 250;
local last_check = 0;
   
function check_key( ttime )
{
    local is_down = fe.get_input_state( key );

    if (is_down)
    {
        if ( ttime - last_check > key_delay )
        {
            last_check = ttime;

            if (info_view==0) {

                if ( config["show_games_list"] == "Yes" )
                {
                    // SEGFAULT IF THIS LINE EXISTS ////////////////////////////////////
                    PropertyAnimation(lb).key("x").from(xpos(44)).to(xpos(-405)).duration(slide_time).easing("ease-in-out-circle").play();
                }
           
            }
        }
    }
}
fe.add_ticks_callback("check_key");