summaryrefslogtreecommitdiff
path: root/gtk/gtkobject.h
diff options
context:
space:
mode:
authorTim Janik <timj@gimp.org>1998-02-02 18:44:28 +0000
committerTim Janik <timj@src.gnome.org>1998-02-02 18:44:28 +0000
commiteeaefdf04fd1972f1c9bcd98997f940efe372d83 (patch)
tree09edbde13a5d538f05dc59a4c76b979ab11ce2e6 /gtk/gtkobject.h
parent8822bde131bb324a231e0f668f0c02aa6b755d16 (diff)
downloadgtk+-eeaefdf04fd1972f1c9bcd98997f940efe372d83.tar.gz
fixed a bad, bad referencing bug that could caused unreferencing of
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> * gtk/gtkmain.c (gtk_propagate_event): fixed a bad, bad referencing bug that could caused unreferencing of finalized objects. * gtk/testgtk.c: destroy fileselection on "OK" (this triggered the above mentioned bug). * gtk/gtkwidget.h: * gtk/gtkwidget.c: * gtk/gtkobject.h: * gtk/gtkobject.c: implemented and object reference tracer (gtk_trace_referencing) which is activated if GTK_TRACE_OBJECTS is defined (currently per default). in gdb: set the static variable `gtk_trace_object' to point to the object that you want to have reference traced. * gtk/gtkfileselection.c: few cleanups.
Diffstat (limited to 'gtk/gtkobject.h')
-rw-r--r--gtk/gtkobject.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/gtk/gtkobject.h b/gtk/gtkobject.h
index 958f7893f1..50c911d76e 100644
--- a/gtk/gtkobject.h
+++ b/gtk/gtkobject.h
@@ -18,6 +18,8 @@
#ifndef __GTK_OBJECT_H__
#define __GTK_OBJECT_H__
+#define GTK_TRACE_OBJECTS 1
+
#include <gtk/gtkenums.h>
#include <gtk/gtktypeutils.h>
@@ -199,10 +201,9 @@ GtkObject* gtk_object_new (guint type,
GtkObject* gtk_object_newv (guint type,
guint nargs,
GtkArg *args);
-
+void gtk_object_sink (GtkObject *object);
void gtk_object_ref (GtkObject *object);
void gtk_object_unref (GtkObject *object);
-void gtk_object_sink (GtkObject *object);
void gtk_object_weakref (GtkObject *object,
GtkDestroyNotify notify,
@@ -289,6 +290,18 @@ GtkObject* gtk_object_check_cast (GtkObject *obj,
GtkObjectClass* gtk_object_check_class_cast (GtkObjectClass *klass,
GtkType cast_type);
+void gtk_trace_referencing (gpointer *object,
+ const gchar *func,
+ guint local_frame,
+ guint line,
+ gboolean do_ref);
+
+#if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
+# define gtk_object_ref(o) G_STMT_START{static guint f=0;gtk_trace_referencing((gpointer)o,__PRETTY_FUNCTION__,++f,__LINE__, 1);f--;}G_STMT_END
+# define gtk_object_unref(o) G_STMT_START{static guint f=0;gtk_trace_referencing((gpointer)o,__PRETTY_FUNCTION__,++f,__LINE__, 0);f--;}G_STMT_END
+#endif /* GTK_TRACE_OBJECTS && __GNUC__ */
+
+
#ifdef __cplusplus
}