[Gtk-sharp-list] "Got a SIGSEGV" with ComboBoxEntry and a ListStore of custom type

Lea Herzog sheket.inred at gmail.com
Sat Jul 5 20:19:01 UTC 2014


Hello everybody,
I've been searching all over the web to give solution to this and I haven't
been able to come to it. I've subscribed to this list hoping you can help
me.

Here's the thing:
I have a ComboBoxEntry which uses as a model a ListStore of type "Parte" (a
class made by me). I get to render it with no problem, but when I select an
item from the dropdown I get

"Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application."

Here's the relevant code:

--CLASS Parte --
public class Parte
    {
        string nombre;
        string direccion;
        string comuna;

        public Parte (string nom, string d, string com)
        {
            this.nombre = nom;
            this.direccion = d;
            this.comuna = com;
        }

        #region Properties
        public string Nombre {
            get {
                return this.nombre;
            }
            set {
                nombre = value;
            }
        }
        public string Direccion {
            get {
                return this.direccion;
            }
            set {
                direccion = value;
            }
        }

        public string Comuna {
            get {
                return this.comuna;
            }
            set {
                comuna = value;
            }
        }
        #endregion
    }

-- MAIN WINDOW --
public partial class MainWindow: Gtk.Window
    {
        public event EventHandler NombreChanged;

        /*
         * OBSERVACIONES:
         * El problema no tiene nada que ver con el renderer,
aparentemente. Surge independientemente de como se renderice
         * Me voy a la chucha con esta wea, quiza deba buscar una forma
alternativa de hacerlo.
         * C T M
         */

        public MainWindow (): base (Gtk.WindowType.Toplevel)
        {
            Build ();

            this.cenNom.SetCellDataFunc (this.cenNom.Cells[0], RenderParte);
        }

        public void LlenarNombre (Parte[] nombres)
        {
            if (nombres.Length > 0)
            {
                ((ListStore)this.cenNom.Model).Clear();
                ListStore partes = new ListStore (typeof(Parte));
                foreach (Parte p in nombres)
                    partes.AppendValues (p);

                this.cenNom.Model = partes;
            }
            else
            {
                this.cenNom.Entry.Text = "";
            }
        }

        private void RenderParte (CellLayout cl, CellRenderer cell,
TreeModel model, TreeIter iter)
        {
            Parte p = (Parte) model.GetValue (iter, 0);
            (cell as Gtk.CellRendererText).Text = p.Nombre;
        }
    }


Your help would be much appreciated. Thanks in advance.

Lea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20140705/6d666562/attachment.html>


More information about the Gtk-sharp-list mailing list