Find the answer to your Linux question:
Results 1 to 3 of 3
When I try to add function as g_idle or g_timeout add_full Program runs OK until I click button that adds my function as g_idle or g_timeout. The runtime error is ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2005
    Posts
    66

    Problem with g_add_idle_full g_timeout_add_full


    When I try to add function as g_idle or g_timeout add_full
    Program runs OK until I click button that adds my function as g_idle or g_timeout.
    The runtime error is

    muxec@record:~/na2005/cp2006/montecarlo> ./src/montecarlo

    Debug Message: Entering Potts

    Debug Message: Exiting Potts
    The program 'montecarlo' received an X Window System error.
    This probably reflects a bug in the program.
    The error was 'BadAlloc (insufficient resources for operation)'.
    (Details: serial 147810 error_code 11 request_code 53 minor_code 0)
    (Note to programmers: normally, X errors are reported asynchronously;
    that is, you will receive the error a while after causing it.
    To debug your program, run it with the --sync command line
    option to change this behavior. You can then get a meaningful
    backtrace from your debugger if you break on the gdk_x_error() function.)


    Where the crash causing click handler is

    void
    on_Pause (GtkButton *button,
    gpointer user_data)
    {
    pause=1-pause;
    if (!pause) { funchandle=g_idle_add_full (G_PRIORITY_LOW,(GSourceFunc)(Simulate), NULL, NULL); }
    else g_source_remove(funchandle);
    }


    If Simulate is empty function than there is no problem so the problem is probably in Simulate although I spent lots of time trying to see the bug in Simulate. When I try to run it with --sync the program stop responding and does not even draw widgets. How can I see which line of code caused crash?


    BTW maybe the problem is in malloc it says

    warning: incompatible implicit declaration of built-in function ‘malloc’

    Although I use it as
    char * field; field =malloc(size);

  2. #2
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401
    The program will exit normally (for example calling an abort() or an exit())...

    Is it your program multithread? Can you post the sode of Simulate routine (even with additional needed code)?
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

  3. #3
    Just Joined!
    Join Date
    Aug 2005
    Posts
    66
    Sorry, problem solved. The problem was my attempt to put long integers to short int array and due to async it showed debug message that was after the bad line.

    Moderators, please close this thread.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •