From e6c038125fd204d9c2f8fa3df282ec1b75bc31b1 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 13 Jan 2011 11:46:42 +0100 Subject: Fixed coredump when graphics could not be initiated For instance when DISPLAY was not set --- lib/wx/src/wxe_master.erl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lib/wx/src') diff --git a/lib/wx/src/wxe_master.erl b/lib/wx/src/wxe_master.erl index d8592c133b..9efe59054c 100644 --- a/lib/wx/src/wxe_master.erl +++ b/lib/wx/src/wxe_master.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -128,19 +128,19 @@ init([]) -> process_flag(trap_exit, true), DriverWithArgs = DriverName ++ " " ++ code:priv_dir(wx) ++ [0], - case catch open_port({spawn, DriverWithArgs},[binary]) of - {'EXIT', Err} -> - erlang:error({open_port,Err}); - Port -> - wx_debug_info = ets:new(wx_debug_info, [named_table]), - wx_non_consts = ets:new(wx_non_consts, [named_table]), - true = ets:insert(wx_debug_info, wxdebug_table()), - spawn_link(fun() -> debug_ping(Port) end), - receive - {wx_consts, List} -> - true = ets:insert(wx_non_consts, List) - end, - {ok, #state{cb_port=Port, driver=DriverName, users=gb_sets:empty()}} + try + Port = open_port({spawn, DriverWithArgs},[binary]), + wx_debug_info = ets:new(wx_debug_info, [named_table]), + wx_non_consts = ets:new(wx_non_consts, [named_table]), + true = ets:insert(wx_debug_info, wxdebug_table()), + spawn_link(fun() -> debug_ping(Port) end), + receive + {wx_consts, List} -> + true = ets:insert(wx_non_consts, List) + end, + {ok, #state{cb_port=Port, driver=DriverName, users=gb_sets:empty()}} + catch _:Err -> + error({Err, "Could not initiate graphics"}) end. %%-------------------------------------------------------------------- -- cgit v1.2.3