[erlang-bugs] Segmentation fault when destroying a wx_object

Dan Gudmundsson <>
Thu Feb 6 09:19:43 CET 2014


Ok the previous patch I sent (off list) did not got through my own tests.

I had to re-write the event handling but I think it got better.

Can you please test
https://github.com/dgud/otp/compare/erlang:master...dgud%2Fwx%2Ffix-cb-cleanup

Or https://github.com/dgud/otp/tree/dgud/wx/fix-cb-cleanup

/Dan


On Tue, Feb 4, 2014 at 9:50 PM, Erlang <> wrote:

> Dan
>
> Great job, it works perfectly now.
>
> Many thanks,
>
> Tom
>
> On 4 Feb 2014, at 15:42, Dan Gudmundsson <> wrote:
>
> Ok figured out was it is, wx tries to disconnect the eventhandler i.e. the
> callback on the wxTextCtrl
> when wxTextCtrl have been deleted already when the dialog was deleted.
>
> Since wx did not create the textctrl (xrc does that) the cleanup
> mechanisms
> doesn't get invoked when it is destructed.
>
> Workaround is disconnect the callbacks to such objects before, destroying
> them..
>
> Or delete the line:
>   Disconnect andalso (catch wxEvtHandler:disconnect_impl(CbH,O)),
> in wxe_server
>
> Which I will do in R17
>
> Thanks for the bug report and test case.
> /Dan
>
>
> On Fri, Jan 31, 2014 at 6:30 PM, Dan Gudmundsson <> wrote:
>
>> Ok, well then I will test more, write a test loop and see if I can
>> reproduce it.
>>  Den 31 jan 2014 17:57 skrev "Erlang" <>:
>>
>> It does't matter which way it's closed. It's the call to destroy that
>>> causes the crash (it doesn't occur every time).
>>>
>>> Tom
>>>
>>>
>>> On 31 Jan 2014, at 16:50, Dan Gudmundsson <> wrote:
>>>
>>> No just configure should work now.
>>> How do you close the window?
>>> I just pressed the ok button..
>>> Den 31 jan 2014 17:38 skrev "Erlang" <>:
>>>
>>>> Yeah with wx3.0 64bit. Are there any specific flags you pass to wx when
>>>> building?
>>>>
>>>> Cheers,
>>>>
>>>> Tom
>>>>
>>>>
>>>> On 31 Jan 2014, at 16:23, Dan Gudmundsson <> wrote:
>>>>
>>>> Ok with wx 3.0? 64 bit?
>>>> I will test some more on monday, don't have a Mac at home.
>>>>
>>>> Cheers
>>>> Den 31 jan 2014 16:31 skrev "Erlang" <>:
>>>>
>>>>> Just tested on the pushed changes. The crash still occurs.
>>>>>
>>>>> Regards,
>>>>> Tom
>>>>>
>>>>>
>>>>> On 31 Jan 2014, at 08:54, Dan Gudmundsson <> wrote:
>>>>>
>>>>> A new master branch have been pushed to github can you please test if
>>>>> it works now.
>>>>> I guess you are already using wxWidgets-3.* something, or if not
>>>>> upgrade.
>>>>>
>>>>>  Regards
>>>>> Dan
>>>>>
>>>>>
>>>>> On Wed, Jan 29, 2014 at 6:07 PM, Dan Gudmundsson <>wrote:
>>>>>
>>>>>> I only tested with our internal master, give us a day or two to push
>>>>>> the new things github.
>>>>>>
>>>>>> I will do another tomorrow with github master.
>>>>>> Thanks for the good report.
>>>>>> Den 29 jan 2014 17:42 skrev "Erlang" <>:
>>>>>>
>>>>>> Dan
>>>>>>>
>>>>>>> I've just built the mater branch from GitHub, and the fault still
>>>>>>> occurs. I can prevent the fault occurring if I attach events to the
>>>>>>> wxDialog (parent), and not a child control, but this isn't a complete
>>>>>>> solution.
>>>>>>>
>>>>>>> Erlang solutions build with wx2.8 as far as I know.
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>>
>>>>>>> On 29 Jan 2014, at 16:00, Dan Gudmundsson <> wrote:
>>>>>>>
>>>>>>> Can not reproduce with linux and wxWidgets-2.8.12 or wxWidgets-3.1
>>>>>>> (i.e. master branch on github)
>>>>>>> nor on darwin with erlang-r17-rc (coming soon) and wxWidgets-3.0
>>>>>>>
>>>>>>> What wxWidgets is included in Mac R16B03 (32b) from erlang
>>>>>>> solutions?
>>>>>>> Is that still wxWidgets-2.8 or is it wxWidgets-3.0?
>>>>>>>
>>>>>>> I fixed some wx bugs in R16B03-1 and even more in the coming 17-rc
>>>>>>> so hopefully it should be fixed now.
>>>>>>>
>>>>>>> Regards
>>>>>>> /Dan
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Jan 29, 2014 at 10:37 AM, Erlang <>wrote:
>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> Operating system: OSX 10.9.1
>>>>>>>> Erlang version: R16B03
>>>>>>>> Configure flags: --enable-darwin-64bit
>>>>>>>>
>>>>>>>> I'm getting a seg fault when the XRC dialog is destroyed. This also
>>>>>>>> occurs on the 32bit pre-built binary of R16B03 from erlang-solutions (it
>>>>>>>> does not occur on previous 32bit versions). It only occurs when event
>>>>>>>> handlers are attached, and isn't specifically related to XRC as I get the
>>>>>>>> same error when I destroy a wx_object contained within a wxAuiNotebook (the
>>>>>>>> XRC sample was easier to reproduce).
>>>>>>>>
>>>>>>>> Run xrc:test/0 and simply close the dialog in the provided sample
>>>>>>>> to reproduce the bug (it might require a few attempts).
>>>>>>>>
>>>>>>>> Tom
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> erlang-bugs mailing list
>>>>>>>> 
>>>>>>>> http://erlang.org/mailman/listinfo/erlang-bugs
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140206/37b01420/attachment-0001.html>


More information about the erlang-bugs mailing list