Re: which gtk-win32 version to use?



Thanks everybody for the answers.

So far, I've only found that one call to pango_layout_get_pixel_size() in my app
was followed by a segfault although the layout is valid, so this remains quite confusing
(at least for me.)

Now I have one more question:

In the linux version, I use g_timeout_add_full() but in the win32 version, I have
to use windows high resolution multimedia timers because the callback function has
to be called every 5 ms (more exactly between 1 and 25 ms) and this doesn't work with
g_timeout_add_full() under windows.

Here is the code for this:

...
GtkWidget       *drawing_area
gint            drawing_area_width, drawing_area_height;
GdkDrawable     *pixmap;
...

static gint callback_function1(...)
{
        ...
        gdk_draw_drawable(
                GDK_DRAWABLE(drawing_area->window),
                gc, pixmap, x, 0, 0, 0,
                drawing_area_width, drawing_area_height);
        ...
        return TRUE;
}

#ifdef G_OS_WIN32
static void CALLBACK callback_function2(...)
{
        ...
        callback_function1(...);
        return:
}
#endif

...
delay = 5;
...
#ifndef G_OS_WIN32
        g_timeout_add_full(G_PRIORITY_HIGH, delay, callback_function1, NULL, NULL);
#else
        /* getting highest resolution */
        mmr = timeGetDevCaps(&tc, sizeof(TIMECAPS));
        win32_mmtimer_highest_res = tc.wPeriodMin;

        /* setting highest resolution and some compatible delay */
        timeBeginPeriod(win32_mmtimer_highest_res);
        delay = MAX((unsigned)delay, win32_mmtimer_highest_res);

        /* creating timer */
        timer_id = timeSetEvent((unsigned int)delay,
                                win32_mmtimer_highest_res,
                                callback_function2,
                                dwUser,
                                TIME_PERIODIC);
        if (timer_id == 0) {
                error_message("Win32 mmtimer creation failed");
                exit();
        }
#endif
...

Although I don't see why, could this be a reason for the segfault?
(Again I'm trying to make sure that  nothing else is involved.)

Thanks.

Manu


On 09/30/2010 03:12 PM, Gabriele Greco wrote:



On Tue, Sep 28, 2010 at 2:50 PM, Manu <manutm007 gmail com <mailto:manutm007 gmail com>> wrote:



    Thanks. I have just installed gdb for mingw.


Another thing that helps to catch problems that you cannot reproduce easily is Dr.Mingw, you can find it in the mingw-utils package. It's a crash handler to be installed on the windows machine.

If you compile your source code with -gstabs debug symbols is able to show you the stack trace of your program when it crashes.
--
Bye,
 Gabry





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