Re: problem with gtk_signal_connect



    safemode> My previous posting about gtk+ 2.0 marshaller seems to have the
    safemode> some symptoms that are described here.  Only i am not trying to
    safemode> pass something slightly different.  It was under my
    safemode> understanding that gtk_signal_connect didn't _need_ to be passed
    safemode> a gpointer, just a pointer.  Please see my previous post titled
    safemode> "gtk+ 2.0 marshaller problems with passing non gpointer
    safemode> variables?"

Sorry, I misplaced your note earlier.  Just found it again.

Based on the symptoms you describe, my guess would be the following.  You have
a function that looks something like this:

  void add_signal(GtkWidget *button) {
     info chosen;

     gtk_signal_connect(GTK_OBJECT (button), "clicked",
                        GTK_SIGNAL_FUNC(create_file_select), &chosen);
  }

The value of the "chosen" variable only survives inside the scope of
add_signal().  It needs to be allocated:

  void add_signal(GtkWidget *button) {
     info *chosen;

     chosen = (info *) malloc(sizeof(info));
     gtk_signal_connect(GTK_OBJECT (button), "clicked",
                        GTK_SIGNAL_FUNC(create_file_select), chosen);
  }

I haven't encountered any problems attributable to marshalling in 1.3.9
(a.k.a. 2.0) yet.
-----------------------------------------------------------------------------
Mark Leisher                           Rights surrendered are not easily
Computing Research Lab                 regained, and a police state is not
New Mexico State University            worth defending.
Box 30001, Dept. 3CRL                     -- Patrick O'Grady
Las Cruces, NM  88003




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]