diff options
author | Owen Taylor <otaylor@redhat.com> | 1999-06-02 03:29:39 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1999-06-02 03:29:39 +0000 |
commit | f9aee08d6e027ffa79f70e9ac580d9ab3c5eea37 (patch) | |
tree | 5aca3cd26395f95324e8381b0cc338e7f861a11b | |
parent | c084c71294539f17421eff2a0e39992ec1914afe (diff) | |
download | gdk-pixbuf-f9aee08d6e027ffa79f70e9ac580d9ab3c5eea37.tar.gz |
Get the reference counting right when we have to attach a new style for a
Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_attach): Get the reference
counting right when we have to attach a new style
for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>)
* gtk/gtkstyle.c: Documented the refcounting
peculularities of gtk_style_attach.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 9 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 45 |
8 files changed, 107 insertions, 1 deletions
@@ -1,3 +1,12 @@ +Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c (gtk_style_attach): Get the reference + counting right when we have to attach a new style + for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>) + + * gtk/gtkstyle.c: Documented the refcounting + peculularities of gtk_style_attach. + 1999-06-01 <timj@dhcpd7.redhat.com> * gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index cea888b1b..98fa576ca 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c (gtk_style_attach): Get the reference + counting right when we have to attach a new style + for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>) + + * gtk/gtkstyle.c: Documented the refcounting + peculularities of gtk_style_attach. + 1999-06-01 <timj@dhcpd7.redhat.com> * gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cea888b1b..98fa576ca 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c (gtk_style_attach): Get the reference + counting right when we have to attach a new style + for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>) + + * gtk/gtkstyle.c: Documented the refcounting + peculularities of gtk_style_attach. + 1999-06-01 <timj@dhcpd7.redhat.com> * gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index cea888b1b..98fa576ca 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c (gtk_style_attach): Get the reference + counting right when we have to attach a new style + for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>) + + * gtk/gtkstyle.c: Documented the refcounting + peculularities of gtk_style_attach. + 1999-06-01 <timj@dhcpd7.redhat.com> * gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cea888b1b..98fa576ca 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c (gtk_style_attach): Get the reference + counting right when we have to attach a new style + for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>) + + * gtk/gtkstyle.c: Documented the refcounting + peculularities of gtk_style_attach. + 1999-06-01 <timj@dhcpd7.redhat.com> * gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cea888b1b..98fa576ca 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c (gtk_style_attach): Get the reference + counting right when we have to attach a new style + for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>) + + * gtk/gtkstyle.c: Documented the refcounting + peculularities of gtk_style_attach. + 1999-06-01 <timj@dhcpd7.redhat.com> * gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cea888b1b..98fa576ca 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c (gtk_style_attach): Get the reference + counting right when we have to attach a new style + for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>) + + * gtk/gtkstyle.c: Documented the refcounting + peculularities of gtk_style_attach. + 1999-06-01 <timj@dhcpd7.redhat.com> * gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index f056ba8ed..8ab899e84 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -477,6 +477,41 @@ gtk_style_new (void) return style; } +/************************************************************* + * gtk_style_attach: + * Attach a style to a window; this process allocates the + * colors and creates the GC's for the style - it specializes + * it to a particular visual and colormap. The process + * may involve the creation of a new style if the style + * has already been attached to a window with a different + * style and colormap. + * arguments: + * style: + * window: + * results: + * Either the style parameter, or a newly created style. + * If the style is newly created, the style parameter + * will be dereferenced, and the new style will have + * a reference count belonging to the caller. + * + * FIXME: The sequence - + * create a style => s1 + * attach s1 to v1, c1 => s1 + * attach s1 to v2, c2 => s2 + * detach s1 from v1, c1 + * attach s1 to v2, c2 => s3 + * results in two separate, unlinked styles s2 and s3 which + * are identical and could be shared. To fix this, we would + * want to never remove a style from the list of linked + * styles as long as as it has a reference count. In fact, + * I don't really think we need attach_count at all if we + * do this. However, the disadvantage of doing it + * this way means that we would need two passes through the linked + * list when attaching (one to check for matching styles, + * one to look for empty unattached styles - but it will almost + * never be longer than 2 elements. + *************************************************************/ + GtkStyle* gtk_style_attach (GtkStyle *style, GdkWindow *window) @@ -518,9 +553,17 @@ gtk_style_attach (GtkStyle *style, new_style = gtk_style_duplicate (style); gtk_style_init (new_style, colormap, depth); } - + + /* A style gets a refcount from being attached */ if (new_style->attach_count == 0) gtk_style_ref (new_style); + + /* Another refcount belongs to the parent */ + if (style != new_style) + { + gtk_style_unref (style); + gtk_style_ref (new_style); + } new_style->attach_count++; |