[gtkada] Stack Overflow with 2 Windows

Jeff Creem jeff at thecreems.com
Wed May 9 00:58:08 CEST 2001


The windows are indeed unique after the call to Gtk_New but
unless you do some more work, you are always working
with the same window (Contacts)..For instances like this,
after a new window is created, I usually save it off in some
window list data structure.

When you get the callback, you can not just use the
package level contacts variable (in a multi-window application)
since it contains a pointer to the last window that was created not
the one that is generating the callback...

You need to find the parent window of the callback object and
then do all close operations and references with respect to that
object.


If you need some examples I have some half finished examples I was
working on I could send you.


----- Original Message ----- 
From: "Matthew Goodwin" <mgoodwin at redrocketconsortium.com>
To: <gtkada at gtkada.eu.org>
Sent: Tuesday, May 08, 2001 12:57 PM
Subject: [gtkada] Stack Overflow with 2 Windows


Greetings!

Using gate/glade generated forms, I get a "stack overflow
(or erroneous memory access)," error when I do the
following:

I have a control panel (like gimp) that launches a form:

procedure On_Btncontact_Clicked
     (Object : access Gtk_Button_Record'Class)
   is
   begin
        Contacts_Pkg.Gtk_New (Contacts_Pkg.Contacts);
        Contacts_Pkg.Show_All (Contacts_Pkg.Contacts);
   end On_Btncontact_Clicked;

I launch two of the same forms (call them A & B), and get
the following behaviour:
if I click the close button
procedure On_Btnclose_Clicked
     (Object : access Gtk_Button_Record'Class)
   is
   begin
      Destroy(Contacts);
   end On_Btnclose_Clicked;

on A, B closes. Then the close button again on A, and the stack overflow
(or erroneous memory access) error.

If I close B, then A - A's close button emits this:
Gtk-CRITICAL **: file gtkobject.c: line 1171
(gtk_object_unref): assertion `object != NULL' failed.

Now, I totally understand what the errors mean, but I am
confused about why:

1) A and B are not unique - I would think Gtk_New would take
care of that.

2) Also, what suggestions are there to make a handler that handles
A and B and C ad infinitum?

Using Gnat3.13p, Linux and Windows98, GtkAda 1.2.8

Thanks for your input,

M. R. Goodwin


_______________________________________________
gtkada mailing list
gtkada at gtkada.eu.org
http://gtkada.eu.org/mailman/listinfo/gtkada






More information about the gtkada mailing list