GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Aug 24, 2016 1:31 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Text View Complaining about Double Free or Corruption
PostPosted: Tue Feb 26, 2008 7:20 pm 

Joined: Tue Feb 26, 2008 7:05 pm
Posts: 1
Was wondering if anybody has any idea(s) why the code below would seem to work fine on GTK/X11 (at least I don't see any error messages), but fail on GTK/DirectFB? When the application is exited by hitting the "Quit" button, I receive the following error message:

*** glibc detected *** TextDemo: double free or corruption (out): 0x4035b1b0 ***

I'm trying to figure out if this is a GTK related problem (i.e., am I'm doing something wrong in GTK) or a problem with GTK/DirectFB. I have to assume that my code IS the problem, but I just don't see where / how.

The reason for doing the sample code this way is that I noticed this problem in my application which destroys the parent view which contains a text view and then re-uses the space for other widgets. The interesting thing is that if I disable the text view creation and only leave the 'Quit' button, the application exits just fine without any messages. I see the same behavior with my "real" application in that I can switch between different forms without any problems unless it contains a text view widget.

What am I doing wrong here?

#include "common.h"

GtkWidget* main_window;

static gboolean destroy_event(GtkWidget* widget, void* data)
       return FALSE;

static void button_click_event(void)

int main(int argc, char* argv[])
       GtkWidget *text_view, *box, *button;

       // initialize multi-threading within GLib

       // initialize multi-threading within GDK

       // acquire thread lock
       gtk_init(&argc, &argv);

       // create main window
       main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
       if (main_window == NULL)
       g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(destroy_event), NULL);

       box = gtk_vbox_new(FALSE, 5);
       if (box == NULL)
       gtk_container_add(GTK_CONTAINER(main_window), box);

       text_view = gtk_text_view_new();
       if (text_view == NULL)
       gtk_box_pack_start(GTK_BOX(box), text_view, TRUE, TRUE, 5);

       button = gtk_button_new_with_label("Quit");
       if (button == NULL)
       g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(button_click_event), NULL);
       gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 5);

       // run the main loop

       // release thread lock

       return 0;

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group