Re: all about gobject references





On Sat, Aug 22, 2009 at 5:10 PM, Siddu <siddu sjce gmail com> wrote:
Hi all,
I want understand Gobject in its entirety . mostly  about references (floating, weak , not so weak) and memory management . Is there any pointers you could point me to read .
 
As a part of the above question the follwing program returns a ref_count of 4 . Can someone explain me y ?
#include <gtk/gtk.h>
#include <stdio.h>


void window_call_back(GtkWidget *widget, gpointer data)
{
  g_print("the ref count of window is %d\n",G_OBJECT(widget)->ref_count);
  gtk_main_quit();
}

int main(int argc,char *argv[]){

  GtkWidget *window;
  gtk_init(&argc,&argv);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(window_call_back),NULL);
  gtk_widget_show(GTK_WIDGET(window));
  gtk_main();
  return 0;
}


 

--
Regards,
~Sid~
I have never met a man so ignorant that i couldn't learn something from him




--
Regards,
~Sid~
I have never met a man so ignorant that i couldn't learn something from him



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