<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">I lifted the missing code, it seems the FlyingJester was miles ahead of me (no surprise there) and after re-reading the code more closely, I then modified my keydown handler to be like this, everything is perfect, not a crash in site, I am probably suffering premature optimisation at this point though! LOL</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><font face="Courier" class="">287 :- func create_key_down_event(key::in, string::in) = (sdl_event::out) is det.</font></div><div class=""><font face="Courier" class="">288</font></div><div class=""><font face="Courier" class="">289 create_key_down_event(_Key, Name) = Event :-</font></div><div class=""><font face="Courier" class="">290     ( if key_name(Name, K) then</font></div><div class=""><font face="Courier" class="">291         Event = key_down(K, Name)</font></div><div class=""><font face="Courier" class="">292     else</font></div><div class=""><font face="Courier" class="">293         Event = key_down(key_unknown, Name)</font></div><div class=""><font face="Courier" class="">294     ).</font></div><div class=""><font face="Courier" class="">295</font></div><div class=""><font face="Courier" class="">296 :- pragma foreign_export("C", create_key_down_event(in,in)</font></div><div class=""><font face="Courier" class="">297     = (out), "createKeyDown”).</font></div><div class=""><br class=""></div><div class="">This removes all crashes and anything not known maps to a key_unknown which is perfect.</div><div class=""><br class=""></div><div class="">Thanks Martin (I know who FlyingJester is really!)</div><div class=""><br class=""></div><div class="">Sean</div><div class=""><br class=""></div></body></html>