HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: What should happen to a _GUIPopupMenu control  (Read 1972 times)

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
What should happen to a _GUIPopupMenu control
« on: Jan 20, 14, 04:33:19 PM »

What should happen to a _GUIPopupMenu control once i click away?
Should it autodestroy itself or i need to handle this myself?

I noticed that when i hit statistics GUI Control Count goes crazy because the _GUIPopupMenu doesn't auto clean itself, but stays somewhere in the memory.

If anyone is using the _GUIPopupMenu control i'd appreciate if they could check out if that happens in their environment as well or i am doing something wrong.

BR
« Last Edit: Jan 20, 14, 04:53:47 PM by AWW_boss »
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: What should happen to a _GUIPopupMenu control
« Reply #1 on: Jan 21, 14, 12:28:12 PM »

Seems that my concerns were true. The _GUIPopupMenu control doesn't get destroyed, but only invisible in method _closePopupMenu() once i click away .

But here is a breathtaking twist. When i override the method _closePopupMenu and set the _GUIPopupMenu control  to destroy itself by introducing this code:
method HE_closePopupMenu()
     DestroyNode(me)
.

i get a 100% reproducible crash.

Submitted under numbers 3597 and 3598.

Logged

WorldWideZ

  • World Owners
  • ****
  • Posts: 524
    • View Profile
    • World Wide Zed
Re: What should happen to a _GUIPopupMenu control
« Reply #2 on: Jan 21, 14, 03:00:42 PM »

i use these too - i see the build up in the stats panel

when i destroy the parent they are removed. they might need removing from the parent before destroying it if you dont plan on destroying the parent during use
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: What should happen to a _GUIPopupMenu control
« Reply #3 on: Jan 21, 14, 03:27:36 PM »

I came up with something like this as a workaround. Each time before i create a new _GUIPopupMenu control i added some code like this, which destroys the existing one:

    defaultPopupLayer as NodeRef of Class GUIControl = FindGUIControlByName(None,"default_popupLayer")
    contextPanel as NodeRef of Class GUIControl = FindGUIControlByName(defaultPopupLayer, "MUD_GUIPopup")
   
    if (contextPanel <> None)
      destroyNode(contextPanel)
    .

This doesn't end up in crash.
   
Logged