clearing a gdk_image through memset



        Is it posible? (clear an image screen through memset)
        I'm trying this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        memset( (void *)oszi_image->mem,
                (int)black_color.pixel,
                sizeof(oszi_image->mem) * (oszi_height * oszi_width) );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        to clear the area of a gdk_image (as a black rectangle).

        Then I draw a sine wave on it (kinda oscilloscope). The
        problem is that as soon as I stop the idle function the
        program crashes with a SIGSEGV signal. (in free() according
        to gdb).

        These are other related fcns:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* callback used when user click on a button to start the display */
void
start_tuner_loop(GtkButton       *button,
                 gpointer         user_data)
{
[...]
        idle_handler_id = gtk_idle_add( tuner_idle, NULL );
        go_tuner = 1;
}

/* idle fcn */
gint
tuner_idle( gpointer data )
{
[...]
        gtk_widget_draw( grs_main_window, NULL );

        redraw_oszi( (double)note.freq, dsp_data.sample_rate, dsp_data.inbuf, nsamples );
        return TRUE;
}

/* stop idle fcn */
void
stop_tuner_loop(GtkButton       *button,
                gpointer         user_data)
{
        if ( go_tuner ) {
[...]
                gtk_idle_remove( idle_handler_id );
                go_tuner = 0;
        }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        Thanks a lot in advance for you help.
        Regards,

        - Eduardo.





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