Re: Segfault and cheep mend of gtk_combo_box_get_active_text
- From: Juergen Dankoweit <Juergen Dankoweit T-Online de>
- To: gtk-app-devel-list gnome org
- Subject: Re: Segfault and cheep mend of gtk_combo_box_get_active_text
- Date: Sun, 01 May 2005 08:36:39 +0200
Good morning Oliver,
Am Sonntag, den 01.05.2005, 08:16 +0200 schrieb Olivier:
Dear Matthias,
Below is a simple program where gtk_combo_box_get_active_text
creates a segfault, as well as my (hacking) way of mending it.
Two other persons from gtk-app-devel-list gnome org compiled
it and got no segfault while running. So I rebuilt my system ??
With
pango 1.8.1 in /opt/gnome/share/pango-1.8.1/
atk 1.9.0 in /opt/gnome/share/atk-1.9.0/
gtk+ 2.6.7 in /opt/gnome/share/gtk+-2.6.7/
in this order, all three via
make uninstall
./configure -prefix=/usr
make
make install
and made things tidy (I hope) by running
ldconfig while in /usr/lib. But same result.
Hope that will help you -- and not overcrowed your mbox :-).
Best, and thanks for your work!
Best,
Amities,
Olivier
(Copy to gtk-app-devel-list gnome org for archiving).
-------------Complete and Minimal example------------
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
GtkWidget *window, *my_combo_box;
void my_gtk_widget_destroy(GtkWidget *widget)
{
gtk_widget_destroy(widget);
gtk_main_quit();
}
void selecter(GtkComboBox *combo)
{
gchar *name;
if ((name = gtk_combo_box_get_active_text
(GTK_COMBO_BOX(my_combo_box))) == NULL){
printf("What are we doing in here ???");
} else {
printf("Ok %s \n", name);};
}
The point is here, that my_combo_box COULD not be initialized.
In my programs I had several problems with that behavior and I solved
this by using the widget that is declared in the function call. In your
example it is combo. So the code looks like:
void selecter(GtkComboBox *combo)
{
gchar *name;
if ((name = gtk_combo_box_get_active_text
(combo)) == NULL){
printf("What are we doing in here ???");
} else {
printf("Ok %s \n", name);};
}
Regards
JÃrgen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]