[erlang-questions] wxWidgets

Dan Gudmundsson <>
Wed Jun 15 21:35:17 CEST 2011


On Wed, Jun 15, 2011 at 2:35 PM, Robert Virding <
> wrote:

> The wx application binding of wxWidgets seems to be cause crashes on many
> systems, including MacOSX. After pondering on it I have a number of
> questions:
>
> Is it the wxWidget implementation itself which is buggy?
>             OR
> Is the use of them directly in the BEAM which causes the crashes? Either
> through some inherent match problem, or version mismatch, or ...?
>
> If it is the second, would implementing a completely separate wx process
> solve the problem? I.e. would it be possible to implement such a process
> which would make linking with wxWidgets "safe"?
>
> If so, wouldn't it be better to do just that? Run wxWidgets in a separate
> OS process and use a (non-linked in driver) port to access it? Yes, it would
> be slower but it would work and be more robust.
>
> If this has already been discussed and my questions answered please point
> me in the right direction.
>
>
In most cases it is a bug in the erlang program, then in my driver code, and
a few times it's in wxWidgets.

So mostly it's about testing your application extensively on every
platform.
They all behave slightly different, if you program by the book it works
everywhere, but that is hard since both wxWidgets
(and especially wx) lacks good documentation, so it is always a little trial
and error.

In my experience the main problem is deleting objects, add the same object
twice to a window somewhere and delete the window, wxWidgets will cleanup
and destroy the object twice and erlang will crash.
Or you delete the object yourself but wx has a reference to it somewhere
which also deletes it.

My opinion is that if you have a mission critical application you don't run
the gui on that node, distributed programming is easy
in erlang so use a separate node to connect your gui to the mission critical
system.

Then if the gui crashes it still is a bug whether you have an erlang prompt
with a non descriptive  'EXIT' message from the port or not. Which is why I
chose to write it as a driver in the first place.

I think extending gs and writing a backend for wx is a good idea, where can
hopefully safe guard the programmer from
some errors.

If you want to have it as a port program as an option, it is doable but a
lot of work,
though we accept patches :-)

/Dan
PS: I still haven't had time to look at your reltool crash, sorry about
that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110615/1235da10/attachment.html>


More information about the erlang-questions mailing list