aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src/wxe_master.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-01-13 11:46:42 +0100
committerDan Gudmundsson <[email protected]>2011-03-02 11:22:30 +0100
commite6c038125fd204d9c2f8fa3df282ec1b75bc31b1 (patch)
treecdf3e1dfb5402f9b83c1dcc7e3adb98a3525401e /lib/wx/src/wxe_master.erl
parentcdf46e658a3a11b97f6179c0d416dc8f2e975509 (diff)
downloadotp-e6c038125fd204d9c2f8fa3df282ec1b75bc31b1.tar.gz
otp-e6c038125fd204d9c2f8fa3df282ec1b75bc31b1.tar.bz2
otp-e6c038125fd204d9c2f8fa3df282ec1b75bc31b1.zip
Fixed coredump when graphics could not be initiated
For instance when DISPLAY was not set
Diffstat (limited to 'lib/wx/src/wxe_master.erl')
-rw-r--r--lib/wx/src/wxe_master.erl28
1 files changed, 14 insertions, 14 deletions
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.
%%--------------------------------------------------------------------