aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2015-01-13 12:58:58 +0100
committerDan Gudmundsson <[email protected]>2015-01-13 12:58:58 +0100
commitdf7e1bab57862b4d7c37da4771790a4462c3eca5 (patch)
tree95924f0c30c64263dda1cc38827c4c0295df77a1 /lib/wx/src
parent8ee2d5f59f0e3ceee6895b5af41e563a29a22be2 (diff)
parent8956d9d02190cac3a82b89eb23b68b3494ed390f (diff)
downloadotp-df7e1bab57862b4d7c37da4771790a4462c3eca5.tar.gz
otp-df7e1bab57862b4d7c37da4771790a4462c3eca5.tar.bz2
otp-df7e1bab57862b4d7c37da4771790a4462c3eca5.zip
Merge branch 'maint'
* maint: debugger: Fix debugger save options on mac wx: Do not crash server when going down
Diffstat (limited to 'lib/wx/src')
-rw-r--r--lib/wx/src/wxe_server.erl14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/wx/src/wxe_server.erl b/lib/wx/src/wxe_server.erl
index 465b9da2e0..8ef568c102 100644
--- a/lib/wx/src/wxe_server.erl
+++ b/lib/wx/src/wxe_server.erl
@@ -223,14 +223,18 @@ handle_connect(Object, #evh{handler=undefined, cb=Callback} = EvData0,
Error ->
{reply, Error, State0}
end;
-handle_connect(Object, EvData=#evh{handler=Handler},
+handle_connect(Object, EvData=#evh{handler=Handler},
From, State0 = #state{users=Users}) ->
%% Correct process is already listening just register it
put(Handler, From),
- User0 = #user{events=Listeners0} = gb_trees:get(From, Users),
- User = User0#user{events=[{Object,EvData}|Listeners0]},
- State = State0#state{users=gb_trees:update(From, User, Users)},
- {reply, ok, State}.
+ case gb_trees:get(From, Users) of
+ {value, User0 = #user{events=Listeners0}} ->
+ User = User0#user{events=[{Object,EvData}|Listeners0]},
+ State = State0#state{users=gb_trees:update(From, User, Users)},
+ {reply, ok, State};
+ none -> %% We are closing up the shop
+ {reply, {error, terminating}, State0}
+ end.
invoke_cb({{Ev=#wx{}, Ref=#wx_ref{}}, FunId,_}, _S) ->
%% Event callbacks