hi,

Scanning() is being called as part of g_idle_add().  Scanning() returns
FALSE, which = NULL in C, so your call to g_idle_add() at execution time
resolves to:

g_idle_add((GSourceFunc) 0, (gpointer) 0);

this clearly won't work.

rewrite as:

Scanning_lvl = g_idle_add((GSourceFunc) Scanning, (gpointer) 0);

and make sure Scanning() is declared somewhere beforehand.

and then see if you don't get a different execution result.

r-


On Tue, Jan 20, 2015 at 4:47 PM, Ian Chapman <ichap...@videotron.ca> wrote:

>  Thanks for your reply Richard.
> Yes, I know that.  I thought Scanning() was a lower level than the gtk
> window and thus the StartScan_active() would exit before the mainloop would
> add Scanning() and then only execute Scanning() when nothing else (signals)
> was active.
>
> I was also asking about the GLib-CRITICAL stuff on exiting Scanning().
> Ian.
>
>
> On 01/20/2015 03:34 PM, richard boaz wrote:
>
>  hi,
>
> you are calling the function Scanning() in the g_idle_add() call.
>
>  richard
>
> On Tue, Jan 20, 2015 at 3:23 PM, Ian Chapman <ichap...@videotron.ca>
> wrote:
>
>>  Hi all,
>>
>> Sorry to bother but I'm lost with the workings of
>>
>> guint g_idle_add ()
>>
>> My code is as
>> follows
>>
>> extern "C"
>>
>> void on_StartScan_activate() //from gtk menu item
>>
>> { printf("Start Scan Activated. \n");
>>
>> scan_on_fg =1;
>>
>> Scanning_lvl = g_idle_add((GSourceFunc) Scanning(), (gpointer) 0);
>>
>> printf("Exiting StartScan.\n");  //main.cpp, Line 129
>>
>> return; }
>>
>> I get to Scanning() okay but I don't exit on_StartScan_activeat() until I
>> exit Scanning() (not what I expected).
>>
>> Worse still when I step through Scanning as I exit I get
>>
>> (gdb) next
>>
>>  (main:24011): GLib-CRITICAL **: g_idle_add_full: assertion `function !=
>> NULL' failed
>>
>> on_StartScan_activate () at main.cpp:129
>>
>> (gdb) next
>>
>> Exiting StartScan.
>>
>>
>>  guint Scanning(void)
>>
>> {
>>
>> while(1 == scan_on_fg)
>>
>> { //Bean counting with rest of GUI in control, I hoped. }
>>
>> return(FALSE); //Remove this thread.
>>
>> }
>>
>>
>>  Regards Ian.
>>
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list@gnome.org
>> https://mail.gnome.org/mailman/listinfo/gtk-list
>>
>>
>
>
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to