Re: Segmentation fault in creating basic app using GTK+ (with C)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Dne 05.07.2014 (sob) ob 12:54 +0530 je Anoop SN napisal(a):

> int main(int argc, char *argv[])
> {
>         //Decleration
>         GtkWidget *window;
>         GtkWidget *calButton;
>         GtkWidget *textEntry;
>         GtkWidget *label;
>         GtkWidget *grid;
>         struct mulptr *p = (struct mulptr *)malloc(sizeof(struct
> mulptr));
>         p->one = textEntry;
>         p->two = label;

You have problems with C, not with GTK+. textEntry and label are
uninitialized here (p->one and p->two contain garbage at this point).
You need to create widgets first and only then copy pointers to
structure.

Also, adding -Wall to gcc arguments will warn you about this.

Cheers,
Tadej


-- 
Tadej Borovšak
tadej.borovsak@xxxxxxxxx
tadeboro@xxxxxxxxx
blog.borovsak.si

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list





[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux