Re: [gtk-list] Force refresh/exposure



On Tue, 20 Jul 1999 13:56:39 +0200, Emmanuel Varagnat wrote:
> I've got a dialog box which just contain a label.
> After showing the dialog box I'm calling 'waitpid', so the contents of
> the label isn't shown.

waitpid() normally blocks, unless you call it with the WNOHANG option. Do
you really have to wait on your child process? If not, you can also
install a SIGCHLD handler (see "Advanced programming in the Unix
environment" by Richard Stevens for that).

> Before 'waitpid' i've tried to do:
> -  while (gtk_events_pending())
>         gtk_main_iteration();
>    but it doesn't work

What about:

  while(something == TRUE)
    {
      while (gtk_events_pending())
        gtk_main_iteration();

      waitpid(childpid, &status, WNOHANG);
      /* check status, and set something to FALSE if the child returned */

      usleep(2); /* avoid CPU hogging */
    }

> - and to force the exposure by a 
>   gtk_signal_emit_by_name(GTK_OBJECT(label), "expose_event");
>   but it does a segmentation fault.

Sounds like a wild/dangling pointer. Have you tried running your program
in a debugger? Compile and link with the "-g" option and run your program
in gdb. When you get a segfault, simply type "where" and the debugger will
show you the point where your program crashed.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/




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