Make destroy "normal"
Put the special actions in the handle_call not the terminate
This commit is contained in:
parent
75467be642
commit
e29743310d
1 changed files with 6 additions and 8 deletions
|
@ -730,7 +730,12 @@ handle_call(trim, _From, State) when State#state.head_only == true ->
|
||||||
handle_call(close, _From, State) ->
|
handle_call(close, _From, State) ->
|
||||||
{stop, normal, ok, State};
|
{stop, normal, ok, State};
|
||||||
handle_call(destroy, _From, State=#state{is_snapshot=Snp}) when Snp == false ->
|
handle_call(destroy, _From, State=#state{is_snapshot=Snp}) when Snp == false ->
|
||||||
{stop, destroy, ok, State};
|
leveled_log:log("B0011", []),
|
||||||
|
{ok, InkPathList} = leveled_inker:ink_doom(State#state.inker),
|
||||||
|
{ok, PCLPathList} = leveled_penciller:pcl_doom(State#state.penciller),
|
||||||
|
lists:foreach(fun(DirPath) -> delete_path(DirPath) end, InkPathList),
|
||||||
|
lists:foreach(fun(DirPath) -> delete_path(DirPath) end, PCLPathList),
|
||||||
|
{stop, normal, ok, State};
|
||||||
handle_call(Msg, _From, State) ->
|
handle_call(Msg, _From, State) ->
|
||||||
{reply, {unsupported_message, element(1, Msg)}, State}.
|
{reply, {unsupported_message, element(1, Msg)}, State}.
|
||||||
|
|
||||||
|
@ -740,13 +745,6 @@ handle_cast(_Msg, State) ->
|
||||||
handle_info(_Info, State) ->
|
handle_info(_Info, State) ->
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
terminate(destroy, State) ->
|
|
||||||
leveled_log:log("B0011", []),
|
|
||||||
{ok, InkPathList} = leveled_inker:ink_doom(State#state.inker),
|
|
||||||
{ok, PCLPathList} = leveled_penciller:pcl_doom(State#state.penciller),
|
|
||||||
lists:foreach(fun(DirPath) -> delete_path(DirPath) end, InkPathList),
|
|
||||||
lists:foreach(fun(DirPath) -> delete_path(DirPath) end, PCLPathList),
|
|
||||||
ok;
|
|
||||||
terminate(Reason, State) ->
|
terminate(Reason, State) ->
|
||||||
leveled_log:log("B0003", [Reason]),
|
leveled_log:log("B0003", [Reason]),
|
||||||
ok = leveled_inker:ink_close(State#state.inker),
|
ok = leveled_inker:ink_close(State#state.inker),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue