#94 Critical BUG in GTK Sheet

closed-fixed
Fredy Paquet
None
5
2012-01-05
2011-11-18
Anonymous
No

Mouse selection of sheet cell with text gives application crash. Version GTK Extra 2.1.1, Windows platform, VisualStudio 2008.
For fix bud need relace in file gtkitementry.c strings (number 2249):
gtk_editable_delete_text(GTK_EDITABLE (entry), 0, -1);
if(strlen(text)>0)
gtk_editable_insert_text(GTK_EDITABLE (entry), text, -1, &tmp_pos);
on strings
gtk_editable_delete_text(GTK_EDITABLE (entry), 0, -1);
// edited by raptor
entry->item_n_bytes=0; // crash fix string
if(strlen(text)>0)
gtk_editable_insert_text(GTK_EDITABLE (entry), text, -1, &tmp_pos);
Sorry, I dont know how create patch for fix.

Discussion

  • Fredy Paquet
    Fredy Paquet
    2011-11-26

    This issue might already have been fixed with Bug ID: 3170287
    Did you checkout the latest developer version from CVS ?

    If you cannot produce a patch, please post the complete function source code.

     
  • Fredy Paquet
    Fredy Paquet
    2011-11-26

    • assigned_to: nobody --> fpaquet
     
  • RRaptor
    RRaptor
    2011-12-04

    Fix for Bug ID: 3170287 help in many cases, but at insert empty string field entry->item_n_bytes become incorrect state (not empty) and possible be reason for crash. Full my function text is done:
    void
    gtk_item_entry_set_text (GtkItemEntry *entry,
    const gchar *text,
    GtkJustification justification)
    {
    gint tmp_pos;

    g_return_if_fail (GTK_IS_ITEM_ENTRY (entry));
    g_return_if_fail (text != NULL);

    entry->justification = justification;

    /* Actually setting the text will affect the cursor and selection;
    * if the contents don't actually change, this will look odd to the user.
    */
    if (GTK_ENTRY(entry)->text && strcmp (GTK_ENTRY(entry)->text, text) == 0)
    {
    return;
    }

    if (GTK_ENTRY(entry)->recompute_idle){
    g_source_remove (GTK_ENTRY(entry)->recompute_idle);
    GTK_ENTRY(entry)->recompute_idle = 0;
    }
    if (GTK_ENTRY(entry)->blink_timeout){
    g_source_remove (GTK_ENTRY(entry)->blink_timeout);
    GTK_ENTRY(entry)->blink_timeout = 0;
    }

    tmp_pos = 0;

    gtk_editable_delete_text(GTK_EDITABLE (entry), 0, -1);

    // rraptor edited edited edited edited edited edited
    entry->item_n_bytes=0;

    if(strlen(text)>0)
    gtk_editable_insert_text(GTK_EDITABLE (entry), text, -1, &tmp_pos);

    }

     
  • Fredy Paquet
    Fredy Paquet
    2012-01-04

    I've tested and incorporated your patch into CVS module gtkextra-3 today.
    I will patch gtkextra-2 later.

     
  • Fredy Paquet
    Fredy Paquet
    2012-01-05

    I've incorporated your patch now also into CVS module gtkextra-2 today.

    Many thanks for reporting the bug.

     
  • Fredy Paquet
    Fredy Paquet
    2012-01-05

    • status: open --> closed-fixed