aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2016-05-31 09:15:05 +0200
committerDan Gudmundsson <[email protected]>2016-05-31 09:15:05 +0200
commitffd39bdee7d0cbac044ca6c72afb65689c33b168 (patch)
tree1426bffdff4216370a35e07ded62839de9568cfa /lib/wx/api_gen
parent492b0ac2e3305a37ab507b2ff2d9546456cf61e4 (diff)
parentb304be8094f283001d6dfbafab31ead37c585869 (diff)
downloadotp-ffd39bdee7d0cbac044ca6c72afb65689c33b168.tar.gz
otp-ffd39bdee7d0cbac044ca6c72afb65689c33b168.tar.bz2
otp-ffd39bdee7d0cbac044ca6c72afb65689c33b168.zip
Merge branch 'dgud/wx/fix-seqfault-in-cleanup'
* dgud/wx/fix-seqfault-in-cleanup: wx: Fix occasional seq fault after appliction stops
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r--lib/wx/api_gen/wx_gen_cpp.erl40
-rw-r--r--lib/wx/api_gen/wx_gen_erl.erl2
2 files changed, 28 insertions, 14 deletions
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl
index 55c179142d..84d3990786 100644
--- a/lib/wx/api_gen/wx_gen_cpp.erl
+++ b/lib/wx/api_gen/wx_gen_cpp.erl
@@ -210,7 +210,7 @@ gen_funcs(Defs) ->
w(" void *This = getPtr(bp,memenv);~n"),
w(" wxeRefData *refd = getRefData(This);~n"),
w(" if(This && refd) {~n"),
- w(" if(recurse_level > 1 && refd->type != 4) {~n"),
+ w(" if(recurse_level > 1 && refd->type != 8) {~n"),
w(" delayed_delete->Append(Ecmd.Save(op));~n"),
w(" } else {~n"),
w(" delete_object(This, refd);~n"),
@@ -255,7 +255,21 @@ gen_funcs(Defs) ->
],
w("bool WxeApp::delete_object(void *ptr, wxeRefData *refd) {~n", []),
+ w(" if(wxe_debug) {\n"
+ " wxString msg;\n"
+ " const wxChar *class_info = wxT(\"unknown\");\n"
+ " if(refd->type < 10) {\n"
+ " wxClassInfo *cinfo = ((wxObject *)ptr)->GetClassInfo();\n"
+ " class_info = cinfo->GetClassName();\n"
+ " }\n"
+ " msg.Printf(wxT(\"Deleting {wx_ref, %d, %s} at %p \"), refd->ref, class_info, ptr);\n"
+ " send_msg(\"debug\", &msg);\n"
+ " };\n"),
+
w(" switch(refd->type) {~n", []),
+ w("#if wxUSE_GRAPHICS_CONTEXT~n", []),
+ w(" case 4: delete (wxGraphicsObject *) ptr; break;~n", []),
+ w("#endif~n", []),
Case = fun(C=#class{name=Class, id=Id, abstract=IsAbs, parent=P}) when P /= "static" ->
UglyWorkaround = lists:member(Class, UglySkipList),
HaveVirtual = virtual_dest(C),
@@ -761,7 +775,7 @@ call_wx(_N,{constructor,_},#type{base={class,RClass}},Ps) ->
end;
false ->
case is_dc(RClass) of
- true -> 4;
+ true -> 8;
false ->
case hd(reverse(wx_gen_erl:parents(RClass))) of
root -> Id;
@@ -819,19 +833,19 @@ return_res1(#type{name=Type,base={class,_},single=list,ref=reference}) ->
return_res1(#type{name=Type,base={comp,_,_},single=array,by_val=true}) ->
{Type ++ " Result = ", ""};
return_res1(#type{name=Type,single=true,by_val=true, base={class, _}}) ->
- %% Temporary memory leak !!!!!!
- case {need_copy_constr(Type),Type} of
- {true, _} -> ok;
- {_, "wxGraphics" ++ _} -> ok;
- _ ->
- io:format("~s::~s Building return value of temp ~s~n",
- [get(current_class),get(current_func),Type])
- end,
- case need_copy_constr(Type) of
- true ->
+ case {need_copy_constr(Type), Type} of
+ {true, _} ->
{Type ++ " * Result = new E" ++ Type ++ "(", "); newPtr((void *) Result,"
++ "3, memenv);"};
- false ->
+ {false, "wxGraphics" ++ _} ->
+ %% {"wxGraphicsObject * Result = new wxGraphicsObject(", "); newPtr((void *) Result,"
+ %% ++ "3, memenv);"};
+ {Type ++ " * Result = new " ++ Type ++ "(", "); newPtr((void *) Result,"
+ ++ "4, memenv);"};
+ {false, _} ->
+ %% Temporary memory leak !!!!!!
+ io:format("~s::~s Building return value of temp ~s~n",
+ [get(current_class),get(current_func),Type]),
{Type ++ " * Result = new " ++ Type ++ "(", "); newPtr((void *) Result,"
++ "3, memenv);"}
end;
diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl
index e15bb0b5ad..794de25002 100644
--- a/lib/wx/api_gen/wx_gen_erl.erl
+++ b/lib/wx/api_gen/wx_gen_erl.erl
@@ -482,7 +482,7 @@ arg_type_test(#param{name=Name0,in=In,type=#type{base={class,T},single=true},def
arg_type_test(#param{name=Name0,in=In,type=#type{base={class,T}}, def=none},EOS,Acc)
when In =/= false ->
Name = erl_arg_name(Name0),
- w(" [?CLASS(~sT,~s) || #wx_ref{type=~sT} <- ~s],~s", [Name,T,Name,Name,EOS]),
+ w(" _ = [?CLASS(~sT,~s) || #wx_ref{type=~sT} <- ~s],~s", [Name,T,Name,Name,EOS]),
Acc;
arg_type_test(#param{name=Name0,def=none,in=In,
type={merged,