Problems with Styles (was Re: [gtkada] Tasking with GtkAda for newbies)

Preben Randhol randhol at pvv.org
Fri Feb 9 16:30:30 CET 2001


Emmanuel Briot <briot at gnat.com> wrote on 09/02/2001 (16:16) :
> 

[...]

> You have to explicitely Unref the style the style to free the memory allocated
> for it.

[...]

> I doubt it remains really stable, since Gtk_New does allocate some memory.
> In fact, I don't think it is needed at all in that context, since Get_Style
> just returns a pointer to the structure.

OK thanks, I tried:

   Style := Get_Style (Notify_Dialog.Base_Ebox);
   Set_Rgb (Cyan_Col,  23_810, 45_755, 47_000);
   Set_Background (Style, State_Normal, Cyan_Col);
   Set_Style (Notify_Dialog.Base_Ebox, Style);
   Unref (Style);

Then I get:

   Gtk-CRITICAL **: file gtkstyle.c: line 606 (gtk_style_ref): assertion
   `style->ref_count > 0' failed.

   Gtk-CRITICAL **: file gtkstyle.c: line 616 (gtk_style_unref): assertion
   `style->ref_count > 0' failed.

   [repeated about 30 times or so]

   Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget
   with width 253 and height 55544

   Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget
   with width 253 and height 42853

   raised STORAGE_ERROR

I guess the Unref should be moved to where the dialog is Destroyed? But
then I need to figure out how to change the Callback function first.

-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 «For me, Ada95 puts back the joy in programming.»




More information about the gtkada mailing list