g_idle_add() problem...



Hello,

For a search function I'm trying to create a wrapper function, where my application should stop the first search when the user starts a new search.

Here is my wrapper function: and the definition of the function it calls:

gboolean update_ports_treestore_run (void);
/*
  update_ports_treestore_run contains:
  while (gtk_events_pending()) gtk_main_iteration();
  in the while loop
*/
void update_ports_treestore (void)
{
  static guint event_id;
    if (event_id != 0)
    {
      g_source_remove (event_id);
      event_id = 0;
    }

  event_id = g_idle_add (update_ports_treestore_run, NULL);

}

But it does not work. At first I get a warning on the g_idle_add function: (gcc 2.95.4)
ports-treeview.c: In function `update_ports_treestore':
ports-treeview.c:37: warning: passing arg 1 of `g_idle_add' from incompatible pointer type

So how do I cast my function correct?

Next:

When I quit my programm and the function is not ready, I get a segfault. I don't get a segfault when the function is ready or I don't use g_idle_add (and call the function directly).

The g_source_remove (event_id) seems not to stop the search, the search runs on.

What am I doing wrong?

Thanks for help,
Martin

--
If you've got an idea and need help,    ICQ: 72997139
or just need general encouragement,     MSN: kleinerdrache gmx at
write me a message. ;-)                 Yahoo-Messenger: walking2martin
                                        AIM: littlewizzard



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