safe to use enablelinehook/disablelinehook twice in a row?

Find quick help here to get you started with Hollywood
Post Reply
Bugala
Posts: 1329
Joined: Sun Feb 14, 2010 7:11 pm

safe to use enablelinehook/disablelinehook twice in a row?

Post by Bugala »

I have a bug in my code where for some reason DisableLineHook() in some case stays on, as in it goes to a part of code where EnableLineHook() should have already happened and yet it didnt. instead of finding out where this happens, I am instead using EnableLineHook() at that other part of code. But this now results in a situation where when things work normally, EnableLineHook() happens twice.

Do I need to make my own function which keeps track if LineHook is Enabled or Disabled, to avoid it happening twice, or is it safe to use EnableLineHook() Twice?

In my test it gave no problem using it twice, but is it possible it could in some future update, or on some other platform cause a problem?
User avatar
jPV
Posts: 688
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: safe to use enablelinehook/disablelinehook twice in a row?

Post by jPV »

I really would fix the code instead, and organize it better. DisableLineHook() should only be used briefly and controlled way. If you're branching out from functions without returning them later to get things finished, you'll may get all other kind of issues too. Running out of stack etc..
Bugala
Posts: 1329
Joined: Sun Feb 14, 2010 7:11 pm

Re: safe to use enablelinehook/disablelinehook twice in a row?

Post by Bugala »

In this case I dont think it is worth tracking it down, since this is caused by some extra options which increase the speed of the game, since by default it is too slow for Amigas. These extra speed options are not exactly safe, but they cause some other problems too, so one more bug there isn't that much of a problem, since user should be expected to encounter unexpected behavior anyway, hence it is for user for himself to choose if he wishes to turn the extra speed options on with the cost of stability. And for that reason, since in normal state it doesn't use enable/disablelinehooks at all, I am fine by fixing it simply by adding extra EnableLineHook(), as long as it is safe to do so otherwise.
Post Reply