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

Re: gtk crash



whoops, sorry: i've made a mess with pointers.
progress_bar_menubox is a pointer to the GTK box that contains the dummy ("ghosted") mainmenu: a dummy main menu is a mainmenu made up of unsensitive buttons and is needed in order not to leave the left part of the window empty while the progressbar is being updated. The dummy main menu should be then destroyed as soon as the frontend receives the progress_stop() command, but as i wrote at lines 1682 and following

  /* Altough logically correct, for cosmetic reasons it's better
     * not to destroy the ghosted main menu until a question is
     * asked to the user
     */
        /* gtk_widget_destroy(GTK_WIDGET(data->progress_bar_menubox)); */
        /* data->progress_bar_menubox = NULL; */

In fact, actually, the dummy main menu box is effectively destroyed only at line 1456 with the following code
 1456        if(data->progress_bar_menubox != NULL)
 1457            {
1458 gtk_widget_destroy(GTK_WIDGET(data->progress_bar_menubox));
 1459            data->progress_bar_menubox = NULL;
 1460            }

digging back in my memory i can now clarly remember this was done not only for cosmetic reasons, but mainly as a workaround for those applications that don't call PROGRESS STOP before quitting or calling GO. If a dummy mainmenu is displayed because of the call of, let's say gtk_progress_start, and gtk_progress_stop is not called before a gtk_go() call, then the frontend would end with two main menu (the first one dummy, the second one "real") displayed togheter in a column! The code of the gtk frontend is FULL of hacky pieces of code like that that manage the MANY problems encountered while testing the debian-installer.
As an example, at line 1072

    /* this is just a dirty hack to prevent the description of the
     * disk-partitioner, which is very long, from trashing the screen.
     * A textarea is used as a label to the question frame to
     * wrap long lines of text.
     */
    view = gtk_text_view_new ();

    buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
    gtk_text_buffer_set_text (buffer, q_get_description(q), -1);
    gtk_text_view_set_editable (GTK_TEXT_VIEW(view), FALSE);
    gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW(view), FALSE);
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(view), GTK_WRAP_WORD);
    gtk_text_view_set_left_margin (GTK_TEXT_VIEW(view), 5);
    gtk_text_view_set_right_margin (GTK_TEXT_VIEW(view), 5);

this part of code is no longer needed( and i'll remove it very soon) since that question of the pertitioner is now handled by a gtktreeview, but still someone arrange the description and extended_description of that question.

ciao

attilio




Attilio Fiandrotti wrote:
The progressbar has always been a problem with DFB: i've never seen it work under GTKDFB and i think because of the same reason you've mentioned above. Only after switching to X the progressbar started to work properly, without even the need to touch the old code. progress_bar_menubox = 0x6b74 seems to be right: is a pointer to the gtk box where the progressbar and its sourronding frame is displayed and should never be NULL nor change during operations.
Anyway i'm not sure about how the progressbar is destroyed

here is the error:
Caught signal 11 (at 0x6b74, invalid address)

I found out that the crash happens at 1458:
1456        if(data->progress_bar_menubox != NULL)
1457            {
1458            gtk_widget_destroy(GTK_WIDGET(data->progress_bar_menubox));
1459            data->progress_bar_menubox = NULL;
1460            }

the segfaulting line is 1458: tomorrow i'll have a closer look at the GTK developer reference guide.

attilio


Davide Viti wrote:

inside gtk.c
static int gtk_initialize(struct frontend *obj, struct configuration *conf)

before the following is reached;
    obj->data = NEW(struct frontend_data);
(gdb) p *(struct frontend_data *)obj.data
$42 = {window = 0x0, target_box = 0x0, info_box = 0x0, menu_box = 0x0, button_next = 0x0, button_prev = 0x0, progress_bar = 0x0, progress_bar_menubox = 0x0, progress_bar_frame = 0x0, setters = 0x0, button_val = 0, ask_jump_confirmation = false, dummy_main_menu = false, jump_target = '\0' <repeats 39 times>, q_main = 0x0}

after the call to NEW()
p *(struct frontend_data *)obj.data
$46 = {window = 0x4015b11c, target_box = 0x4015b11c, info_box = 0x6564632f, menu_box = 0x6e6f6362, button_next = 0x72662f66, button_prev = 0x65746e6f, progress_bar = 0x672f646e, progress_bar_menubox = 0x6b74, progress_bar_frame = 0x0, setters = 0x0, button_val = 0, ask_jump_confirmation = false, dummy_main_menu = false, jump_target = '\0' <repeats 39 times>, q_main = 0x0}

as you can see
progress_bar_menubox = 0x6b74

and it is never changed until the crash

hope this helps,

ciao

Davide






Reply to: