adonthell-devel
[Top][All Lists]
Advanced

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

Re: [Adonthell-devel] main_menu bug


From: Alexandre Courbot
Subject: Re: [Adonthell-devel] main_menu bug
Date: Sun, 29 Sep 2002 11:41:23 +0200

> Whenever the player presses ESC, a call is made to adonthell::main.
> This will create a new instance of win_manger. The main menu is then
> attached to this manager. When the menu is closed, a call is made to
> adonthell::main_quit. The win_manager is deleted again. But: the
> actual window is not deleted. If the code would be sane, deleting the
> window manager should also delete all windows still attached to it. 

Hum, I think I have a hint of where it could come from. First, main_menu
is a Python class. It'd not be wise to try to delete its instances from
C, as it inherits from win_container (and therefore, with the virtual
destructor mechanism, we could not have the right destructor called).
Each of its objects belong to the container it inherits from, and are
destroyed by it at destructor time, which is fine (every object created
gets its thisown set to 0). So provided main_menu gets destroyed,
everything should get destroyed.

And this is where the problem lies: the main_menu instance is created in
control.py. It's belongs to Python, and therefore should be destroyed
when the variable gets out of scope (which is fine, as the win_manager
it gets assigned to doesn't try to destroy it when it is destroyed
itself). But: make a print at the end of main_menu's constructor, and
give it a destructor that simply prints something as well. What happen
when you pop the menu up? The constructor's print is displayed, but when
you leave it its destructor's one isn't. This is the only problem we
have: main_menu instances are never deleted where they should be, that
is at the end of the scope where they are created in control.py. Why
that? I have no damn clue. I tried to del() it manually, without any
result. I hope you are less clueless than me. But anyway, it's clear
that nothing is to be changed in win_manager - we have a problem on the
Python side instead.

Hope this will help a bit!
Alex.
-- 
http://www.gnurou.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]