assertion-errer: please Help! (SOLVED!)

Problem: In my game, i have a menue-class, which handles the mainmenue (character customization, itembuying etc.), everything is working fine. So when the “real” game starts, the menue gets destroyed (all gui elements like frames and direct buttons are destroyed manually, and the references to the top menue class are lost/overwritten)… So far so good, but here comes the problem: i wanna switch back from the real game to the menue (after the real game has finished), i destroy everything thats in the “real game” but when i try to recreate that menue class, exactly like i created it first, it throws following error:

Assertion failed: !is_empty() at line 1984 of c:\panda3d-1.7.0\panda\src\pgraph\nodePath.I

This error occures when i call “hide()” on a directFrame-element. But this element should be recreated when i recreate the whole menue class… Weird thing is, if i dont destroy this element at the first time, the error don´t occures (at the second time when i get back to the menue)… it seems the whole class doesnt get recreated, but keept in memory somewhere instead and later gets rereferenced…

I’m realy stuck with this problem since days, soo please help me, whats going wrong. Im realy lost here… :frowning:

It sounds like your analysis is sound: you’re calling hide() on a menu element that has been destroyed, and which hasn’t been recreated.

So, either your attempt to recreate it didn’t work, or it did work but you still have a handle to the old one.

“Still having a handle” could mean that you didn’t reset the member that refers to the menu element; or it could mean that you have a message hook or a task still active that was associated with the old menu element.

David

mhhh…it seems that i “Still having a handle” to the old, destroyed element… because there are no tasks/messages-hooks associated with that element. I see this happens also to other ui-elements and also for the actors which i try to recreate in that class…

I dont get what you meant with “did’t reset the member”, how do i reset a menu element…

How ould i prove that its a handle to the old, destroyed object?

If i call element.ls() The ID Numbers are changign, so i guess the elements are recrated correctly, right?

Example:
first created menue:
PGItem DirectFrame-pg37 T:(pos -1 0 0.2)

later recreated menue:
PGItem DirectFrame-pg141 T:(pos -1 0 0.2)

But in the end i always get:
(empty)

Do you have any idea/advise where i should start eliminating this problem… Im still pretty lost here :frowning:

i found the stupid error: jeeeeeha! I feared that i have to rebuild my whole menue, but now everything is working fine!!!

The problem was:
The container/array where i store some of the data, don’t gets recreated because i don’t initialisized it in the contsruktor/init:

before (not working):

class XXX(DirectObject):
  
  def __init__(self):
      ....
      ....

races=[]

 

after (working!!):

class XXX(DirectObject):
  
  def __init__(self):
      ....
      ....
      self.races=[]

 

meeeh, this gave me serios headaches, but now im fine ;D

Thats whats happens when artists start coding ^^