No data available at callback



First a top level scenario. I am writing an interface application for a flat bed scanner which will result in the use of the gdk function g_signal_connect. I decided to pass some data to my callback function since it would simplify some of the logic. However, to my surprise I found that the callback function received a data pointer of zero (0). This is a sure fire why of getting a segmentation fault. I fine it hard to believe that their would be a bug with function which leads me to believe I am not using the function correctly.

Now some details:
I am running a Fedora 22 distribution that has a gtk3-3.16 and glib2-2.14 versions.

I used a debugger (gdb) to verify that the data pointer of the g_signal_connect did indeed display the data that I wanted to pass to the callback. I also verified that the return from the g_signal_connect was a non zero value. Upon reaching the breakpoint in the callback the data pointer was pointing to zero.

It is not a deal breaker that I use the data option of the function, but I would be nice to know why this is happening in my case.

The source code involved is as follows:
CallBkData dummy, *datapt;
datapt = &dummy;
  datapt->optNum = opt_source;
  datapt->whatever = 6794;
  sigID = g_signal_connect(G_OBJECT(combo), "changed",
                            G_CALLBACK(cs_source_callback),
                            (void *)datapt);


Any insight would be appreciated.



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