Bug 18856 - gtk_clist_get_text() causes segfault
Summary: gtk_clist_get_text() causes segfault
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gtk+   
(Show other bugs)
Version: 7.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Owen Taylor
QA Contact: Dale Lovelace
Depends On:
TreeView+ depends on / blocked
Reported: 2000-10-10 22:03 UTC by Sean Dilda
Modified: 2007-04-18 16:29 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-10-16 15:20:49 UTC
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 22:04 UTC, Sean Dilda
no flags Details

Description Sean Dilda 2000-10-10 22:03:36 UTC
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 22:04:41 UTC
Created attachment 4004 [details]
This is the sample code that will work in RH62, but not RH70

Comment 2 Owen Taylor 2000-10-16 15:36:32 UTC
  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.