You are not logged in.

#1 2014-01-02 20:09:57

EUR
Member
Registered: 2014-01-02
Posts: 3

[SOLVED] C, GTK+ 2 & 3 - Segmentation fault (core dumped)

I am trying to create a GtkTreeView widget, but as soon as it (or something else related to it) gets in, all I get is segmentation fault.

No compilation errors so far. Runtime also results in a one-liner (segfault) and no additional/useful information.

Here are a few examples (just to make sure I'm not doing anything wrong):

Relevant (I guess) packages installed:

core/glibc 2.18-11 (base) [installed]
core/gcc 4.8.2-7 (base-devel) [installed]
extra/gtk2 2.24.22-1 [installed]
extra/gtk3 3.10.6-1 [installed]

What's wrong?

If I ditch GtkTreeView and widgets associated with it, everything works just as one would expect it to.

Update:

I don't know what I am doing (not the whole thing; just this), but I ran gdb and after a few breakpoints I got this:

Program received signal SIGSEGV, Segmentation fault.
0xb7b5156f in gtk_cell_layout_pack_start () from /usr/lib/libgtk-3.so.0

Last edited by EUR (2014-01-02 20:42:18)

Offline

#2 2014-01-02 20:27:46

Trilby
Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 17,258
Website

Re: [SOLVED] C, GTK+ 2 & 3 - Segmentation fault (core dumped)

Are you running those example exactly, or did you just use them as a template for your own program?  If the latter, can you show the actual code you are using.

Offline

#3 2014-01-02 20:30:35

EUR
Member
Registered: 2014-01-02
Posts: 3

Re: [SOLVED] C, GTK+ 2 & 3 - Segmentation fault (core dumped)

At first I was just looking at those examples and writing the code myself, but after I ran into this issue, I tried those examples exactly as they are (copy/paste) and nothing changed.

Funny that they do actually work on my second laptop - architecture and package versions are the same. hmm

I tried re-installing packages listed above and that didn't change a thing either.

Last edited by EUR (2014-01-02 20:32:41)

Offline

#4 2014-01-02 20:36:32

Trilby
Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 17,258
Website

Re: [SOLVED] C, GTK+ 2 & 3 - Segmentation fault (core dumped)

Lets stick with the first example.  How are you compiling it?

Offline

#5 2014-01-02 20:38:46

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,812
Website

Re: [SOLVED] C, GTK+ 2 & 3 - Segmentation fault (core dumped)

Are you using GTK 3?

Are you compiling with debugging information on? ("gcc -g")

Here's how to use GDB:

$ gdb myapp # Start the debugger
run # Start your application
# Now do something to make your application crash
bt # To show the "backtrace"

If you post the debugging information, please also your code.

Offline

#6 2014-01-02 20:41:45

EUR
Member
Registered: 2014-01-02
Posts: 3

Re: [SOLVED] C, GTK+ 2 & 3 - Segmentation fault (core dumped)

Trilby wrote:

Lets stick with the first example.  How are you compiling it?

Thank you for being here while I was just .. unfortunatelly, dumb.

I increased the list size (column count) without adding additional type (G_TYPE_STRING) arguments.

Fixed that and everything's back to normal. smile

drcouzelis wrote:

Are you compiling with debugging information on? ("gcc -g")

Compiling with -g doesn't reveal my mistake.

Last edited by EUR (2014-01-02 20:43:28)

Offline

#7 2014-01-02 20:45:40

Trilby
Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 17,258
Website

Re: [SOLVED] C, GTK+ 2 & 3 - Segmentation fault (core dumped)

No problem - though I'm far from a professional, I do quite a bit of coding and pebkac segfaults and me are old friends that are regularly reaquainted.  They are often due to issues with array bounds or bad pointers.

Offline

Board footer

Powered by FluxBB