[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
randomcode
Kobold
Posts: 27
Joined: Wed Nov 11, 2015 11:31 am
Location: Universe
x 1
Contact:

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

Post by randomcode » Wed Nov 21, 2018 4:08 am

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.
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 715
Joined: Sun Mar 30, 2014 2:51 pm
x 106
Contact:

Re: Access Violation at nukeOverlayElement using SdkTrayGUI

Post by paroj » Sun Dec 16, 2018 12:43 pm

try to reproduce with current master
0 x

randomcode
Kobold
Posts: 27
Joined: Wed Nov 11, 2015 11:31 am
Location: Universe
x 1
Contact:

Re: Access Violation at nukeOverlayElement using SdkTrayGUI

Post by randomcode » Wed Feb 06, 2019 1:01 pm

paroj wrote:
Sun Dec 16, 2018 12:43 pm
try to reproduce with current master
Thanks, it has been solved :D
0 x
AMGE(Open Source C# Role-play Engine)
https://github.com/cookgreen/AMGE

Post Reply