aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2014-02-06 16:59:12 +0100
committerDan Gudmundsson <[email protected]>2014-02-06 16:59:12 +0100
commitb07eae7aefeff5d42e11c319c660f1f2d2cac5fd (patch)
tree79ebb1db37fdf8e54c9e8707e4954ce0e08a7463 /lib
parent115e23b02caae4e8ccdb6f9ea3422bfd1b2e4abd (diff)
downloadotp-b07eae7aefeff5d42e11c319c660f1f2d2cac5fd.tar.gz
otp-b07eae7aefeff5d42e11c319c660f1f2d2cac5fd.tar.bz2
otp-b07eae7aefeff5d42e11c319c660f1f2d2cac5fd.zip
observer: catch progressbar errors
If cdv window is closed when progressbar was still running error reports came to error logger (i.e. mostly test problem on slow machines)
Diffstat (limited to 'lib')
-rw-r--r--lib/observer/src/observer_lib.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/observer/src/observer_lib.erl b/lib/observer/src/observer_lib.erl
index e0f7bf482b..cedaf7d2b8 100644
--- a/lib/observer/src/observer_lib.erl
+++ b/lib/observer/src/observer_lib.erl
@@ -699,7 +699,9 @@ progress_handler(Caller,Env,Title,Str) ->
register(?progress_handler,self()),
wx:set_env(Env),
PD = progress_dialog(Env,Title,Str),
- progress_loop(Title,PD,Caller).
+ try progress_loop(Title,PD,Caller)
+ catch closed -> normal end.
+
progress_loop(Title,PD,Caller) ->
receive
{progress,{ok,done}} -> % to make wait_for_progress/0 return
@@ -738,8 +740,12 @@ progress_dialog(_Env,Title,Str) ->
PD.
update_progress(PD,Value) ->
- wxProgressDialog:update(PD,Value).
+ try wxProgressDialog:update(PD,Value)
+ catch _:_ -> throw(closed) %% Port or window have died
+ end.
update_progress_text(PD,Text) ->
- wxProgressDialog:update(PD,0,[{newmsg,Text}]).
+ try wxProgressDialog:update(PD,0,[{newmsg,Text}])
+ catch _:_ -> throw(closed) %% Port or window have died
+ end.
finish_progress(PD) ->
wxProgressDialog:destroy(PD).