[1.7.4][Mogre][Solved]Access Violation at nukeOverlayElement using SdkTrayGUI Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
randomcode
Halfling
Posts: 53
Joined: Wed Nov 11, 2015 11:31 am
Location: People's Republic of China
x 5
Contact:

[1.7.4][Mogre][Solved]Access Violation at nukeOverlayElement using SdkTrayGUI

Post by randomcode »

Ogre Version: :1.74:

Code: Select all

       public static void nukeOverlayElement(OverlayElement element) 
       {
            Mogre.OverlayContainer container = element as Mogre.OverlayContainer;
            if (container != null) {
                List<Mogre.OverlayElement> toDelete = new List<Mogre.OverlayElement>();

                Mogre.OverlayContainer.ChildIterator children = container.GetChildIterator();
                while (children.MoveNext()) {
                    toDelete.Add(children.Current);
                }

                for (int i = 0; i < toDelete.Count; i++) {
                    nukeOverlayElement(toDelete[i]);
                }
            }
            if (element != null) {
                Mogre.OverlayContainer parent = element.Parent;
                if (parent != null)
                    parent.RemoveChild(element.Name);
                Mogre.OverlayManager.Singleton.DestroyOverlayElement(element);
            }
        }
I use nukeOverlayElement to destroy the overlayElement, but it crashed at the

Code: Select all

Mogre.OverlayManager.Singleton.DestroyOverlayElement(element);
Any ideas?


---------------------------Edit-----------------------

This problem has been solved myself
Cased by the wrong call:
I should use the

Code: Select all

nukeOverlayElement
directly to destroy an overlay element rather than

Code: Select all

DestroyOverlayElement
Last edited by randomcode on Thu Feb 07, 2019 6:47 am, edited 4 times in total.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Access Violation at nukeOverlayElement using SdkTrayGUI

Post by paroj »

try to reproduce with current master
User avatar
randomcode
Halfling
Posts: 53
Joined: Wed Nov 11, 2015 11:31 am
Location: People's Republic of China
x 5
Contact:

Re: Access Violation at nukeOverlayElement using SdkTrayGUI

Post by randomcode »

paroj wrote: Sun Dec 16, 2018 12:43 pm try to reproduce with current master
Thanks, it has been solved :D
OpenMB(Open Source Mount&Blade Series)
https://github.com/cookgreen/OpenMB
Post Reply