You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess I've seen the wrongness of my ways. The window is created at class definition time, not at object instantiation time. This changes are enough to fix the problem
- class wrapper =+ class wrapper () =
- let wrapper = new wrapper+ let wrapper = new wrapper ()
to fix the problem. Still it will be nice to have a check is_gtk_main_initialized before the ml_g_object_new is called.
Not sure how hard is this to add.
The semantics of let in parameterless classes is very confusing.
Basically the let is executed at class initialization time, but a new object will be created each time you call new.
I was not aware of the change of behavior between Gtk2 and Gtk3, since the change is not on the lablgtk side.
Of course, the code is incorrect under Gtk2 too, as the critical warning shows.
As for checking for initialization, we could do it before creating widgets. It is very simple to add for wrappers generated by propcc, but there may be a few raw *_new functions around, which would require adding the check by hand.
I have a simple program which works with
lablgtk2
but segfaults withlablgtk3
. The programAnd I compile it using
ocamlfind ocamlc -package lablgtk3 -linkpkg -thread -g -o demo demo.ml
And when I run it segfaults wtih the following stack trace
The text was updated successfully, but these errors were encountered: