On 22 November 2010 05:44, Abderrahim Kitouni <[email protected]> wrote:
> Hi,
>                   في ح، 21-11-2010 عند 16:03 +1030 ، كتب James Moschou:
>> Here's an incredibly pared back version of what I have:
>>
>>
>> class Task : Object {
>>     Pid _pid;
>>     Source _source;
>>     public async void run_async () {
>>         try {
>>             Process.spawn_async_with_pipes (null,
>>                                             {"whois", "www.google.com"},
>>                                             null,
>>                                             SpawnFlags.SEARCH_PATH |
>> SpawnFlags.DO_NOT_REAP_CHILD,
>>                                             null,
>>                                             out _pid,
>>                                             null,
>>                                             null,
>>                                             null);
>>
>>             _source = new GLibFixes.ChildWatchSource (_pid);
>>             _source.attach (null);
>>             _source.set_callback (run_async.callback);
>
> Just replace the three above lines with:
>              ChildWatch.add (_pid, (pid, status) => run_async.callback());
> and it won't segfault (and won't need fixes in GLib bindings either :-)
>
>>             yield;
>>         }
>>         catch (Error error) {
>>             stderr.printf ("%s\n", error.message);
>>         }
>>         Process.close_pid (_pid);
>>     }
>> }
>
> HTH,
> Abderrahim
>
>

Thanks a lot!
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to