Bug 18856 - gtk_clist_get_text() causes segfault
gtk_clist_get_text() causes segfault
Product: Red Hat Linux
Classification: Retired
Component: gtk+ (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Owen Taylor
Dale Lovelace
Depends On:
  Show dependency treegraph
Reported: 2000-10-10 18:03 EDT by Sean Dilda
Modified: 2007-04-18 12:29 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-10-16 11:20:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
This is the sample code that will work in RH62, but not RH70 (462 bytes, text/plain)
2000-10-10 18:04 EDT, Sean Dilda
no flags Details

  None (edit)
Description Sean Dilda 2000-10-10 18:03:36 EDT
I have sample code that works fine on Red Hat 6.2, but when compiled and
run on a Red Hat 7.0 box, the program segfaults in gtk_clist_get_text()
As far as I can tell, all my code for this is valid.
Comment 1 Sean Dilda 2000-10-10 18:04:41 EDT
Created attachment 4004 [details]
This is the sample code that will work in RH62, but not RH70
Comment 2 Owen Taylor 2000-10-16 11:36:32 EDT
  gchar **celltext;


  gtk_clist_get_text(GTK_CLIST(clist), row, 0, celltext);

You are telling GTK+ to store the text in the location pointed
to by celltext, but celltext is unitialized, so you are telling
GTK+ to store it in random memory. If it worked with 6.2
it was complete and utter coincidence.


  gchar *celltext;

  gtk_clist_get_text(GTK_CLIST(clist), row, 0, &celltext);

To avoid problems like this, you should

 * Compile with -Wall
 * Believe the warnings
 * Read up a bit on pointers

Note You need to log in before you can comment on or make changes to this bug.