Pointer problems
- From: rhfreeman <rhfreeman micron com>
- To: "'gtk-list gnome org'" <gtk-list gnome org>
- Subject: Pointer problems
- Date: Tue, 13 Jun 2000 08:27:14 -0600
Hi all,
Interesting one this - using signals my program appears to be getting
confused at to which pointers are being passed where! Here is a quick
overview of the code.
****
Globals:
#define MAX_WINDOWS 32
typedef struct _window_layout
{
// stuff (which includes a clist)
gint id;
} window_layout;
static window_layout w_layout[MAX_WINDOWS];
****
Main:
gpointer ptr[MAX_WINDOWS];
// blah
for (i=0; i<MAX_WINDOWS; i++)
{
// does stuff to each element of the array
ptr[i]=&w_layout[i];
gtk_signal_connect(GTK_OBJECT(w_layout[i].signal_lists),
"size_allocate", GTK_SIGNAL_FUNC(clist_size), ptr[i]);
}
****
void clist_size(GtkWidget *clist, GtkAllocation *allocation, gpointer
current_list)
{
window_layout current_window;
current_window=*(window_layout*) current_list;
printf("ALLOC: %d ---- %d\n", allocation->width, current_window.id);
}
*****
The problem is the value of current_window.id in clist_size() seems to
wander. Every time you add a panel, it should count each panel, but it
starts to wander.
Panels added current_window.id
1 0
2 0, 1 (this is correct, but
then something odd happens)
3 0, 0, 2
4 0, 0, 2, 3
5 0, 0, 2, 0, 4
Help! This is driving me spare!
Rich
PS - Thanks to Havoc for helping me get this far!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]