Re: GtkGC shared auto-release



Torsten Schoenfeld <kaffeetisch gmx de> writes:

+  *Gtk2::GC::release = sub {
+    $_[1]->{COUNT_KEY()}--;
+    $old_release->(@_);

You might guard against count==0 there, since gtk_gc_release will segv
if called too many times, and since presumably if that's fixed it'd be
by gtk_gc_release ignoring attempts to do more releases than gets
(ie. the count of needed releases shouldn't go negative).

+  my $two = Gtk2::GC -> get(32, $colormap, $values);
+  Gtk2::GC -> get(32, $colormap, $values);
+  Gtk2::GC -> get(32, $colormap, $values);
+  # Gtk2::GC -> release($two) should now be called three times, but how do we
+  # verify that?
+}

Too few releases should leave the pool with a ref on the GC, so perhaps
keep only a weakened copy of the GC and check that goes undef when the
pool lets go.



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