Page 1 of 1

HEAD/trunk gives runtime errors

Posted: Sun Aug 12, 2007 10:34
by Liberator
Hi,

I was wondering whether the following is a known problem:
When using the HEAD revision of CEGUI I got got hit with problems I did not have while using 0.5. The reason I switched was because I need Tree widget support. Not only do I get the message shown below, if I try to add items to the Tree control the whole thing crashes with an access violation in a string object (CEGUIString.cpp line 670). It seems like the string object being accessed is invalid.
The 'there is no property FrameColours error' is one I get every time I resize the window which causes a stack unwind making everything very slow. Of course the error should not occur in the first place.


Code: Select all


-- snip --

[SYSTEM] [LVL 2] [CEGUI] Window 'CGUIEditor:WindowTree__auto_vscrollbar____auto_decbtn__' of type 'TaharezLook/ImageButton' has been created.
[SYSTEM] [LVL 2] [CEGUI] Assigning the window renderer 'Falagard/Button' to the window 'CGUIEditor:WindowTree__auto_vscrollbar____auto_decbtn__'
[SYSTEM] [LVL 2] [CEGUI] Assigning LookNFeel 'TaharezLook/ImageButton' to window 'CGUIEditor:WindowTree__auto_vscrollbar____auto_decbtn__'.
[SYSTEM] [LVL 2] [CEGUI] Window 'CGUIEditor:WindowTree__auto_vscrollbar____auto_thumb__' of type 'TaharezLook/VerticalScrollbarThumb' has been created.
[SYSTEM] [LVL 2] [CEGUI] Assigning the window renderer 'Falagard/Button' to the window 'CGUIEditor:WindowTree__auto_vscrollbar____auto_thumb__'
[SYSTEM] [LVL 2] [CEGUI] Assigning LookNFeel 'TaharezLook/VerticalScrollbarThumb' to window 'CGUIEditor:WindowTree__auto_vscrollbar____auto_thumb__'.
[SYSTEM] [LVL 0] [CEGUI] Exception: There is no Property named 'SelectionBrushImage' available in the set.
[SYSTEM] [LVL 0] [CEGUI] Exception: There is no Property named 'NormalTextColour' available in the set.
[SYSTEM] [LVL 0] [CEGUI] Exception: There is no Property named 'SelectedTextColour' available in the set.
[SYSTEM] [LVL 0] [CEGUI] Exception: There is no Property named 'ActiveSelectionColour' available in the set.
[SYSTEM] [LVL 0] [CEGUI] Exception: There is no Property named
'InactiveSelectionColour' available in the set.

-- snip --




I have also tried the CEGUI samples and only a sub-set of them actually work. I compiled the samples to use OpenGL while my engine uses Ogre.

Posted: Sun Aug 12, 2007 11:39
by Liberator
I just discovered the access violation occurs when I use the following code:

Code: Select all


-- snip --

                    CEGUI::TreeItem* parentEntry = m_windowList->findFirstItemWithText( parentWindow->getName() );
                    if ( NULL != parentEntry )
                    {
                        parentEntry->addItem( treeItem );
                    }

-- snip --



It seems that adding items to a parent entry in this manner causes the crash. If I comment out the parentEntry->addItem line it works fine.
Either the addItem code is bugged or findFirstItemWithText() can return a bogus pointer.

- EDIT:

I modified the addItem line as follows:
parentEntry->addItem( new CEGUI::TreeItem( "Test" ) );

This also crashes so findFirstItemWithText() returning a bogus pointer is not the cause. It now seems likely that simply adding children to an item in a Tree widget in the manner I described causes a crash.

Posted: Sat Aug 18, 2007 13:03
by Liberator
Is anyone still working on CEGUI and reading this ?

fix

Posted: Wed Sep 05, 2007 19:40
by Liberator
In case anyone cares...


I had a couple of hours today to debug this and found that, after fixing missing member variable initializations, that the main problem was the commented out initialise() class in the Tree widget. I made a number of fixes and everything works now. If anyone is interested in the fixes gimme a shout. Not initializing member variables is something that really should be checked :cry:

Posted: Thu Sep 06, 2007 14:59
by Rackle
Development is done in "spare" time, something which I haven't had any for too many months now. I'm sure the other devs are having the same problem.

Path file

Posted: Thu Sep 06, 2007 16:24
by Liberator
Here is the patch I made with SVN

Code: Select all

Index: trunk/include/CEGUIString.h
===================================================================
--- trunk/include/CEGUIString.h   (revision 1480)
+++ trunk/include/CEGUIString.h   (working copy)
@@ -4802,6 +4802,7 @@
       d_encodedbuff      = 0;
       d_encodedbufflen   = 0;
       d_encodeddatlen      = 0;
+      d_buffer            = 0;
       setlen(0);
    }
 
Index: trunk/include/CEGUIWindow.h
===================================================================
--- trunk/include/CEGUIWindow.h   (revision 1480)
+++ trunk/include/CEGUIWindow.h   (working copy)
@@ -1963,7 +1963,7 @@
     \note
         Once a look'n'feel has been assigned it is locked - as in cannot be changed.
     */
-    void setLookNFeel(const String& look);
+    virtual void setLookNFeel(const String& look);
 
     /*!
     \brief
Index: trunk/include/elements/CEGUITree.h
===================================================================
--- trunk/include/elements/CEGUITree.h   (revision 1480)
+++ trunk/include/elements/CEGUITree.h   (working copy)
@@ -442,6 +442,9 @@
    \exception   InvalidRequestException   thrown if \a item_index is out of range for the list box
    */
    void   setItemSelectState(size_t item_index, bool state);
+   
+   
+   virtual void setLookNFeel(const String& look);
 
 
    /*!
Index: trunk/src/elements/CEGUITree.cpp
===================================================================
--- trunk/src/elements/CEGUITree.cpp   (revision 1480)
+++ trunk/src/elements/CEGUITree.cpp   (working copy)
@@ -79,13 +79,14 @@
       d_itemTooltips(false),
       d_lastSelected(NULL),
       d_horzScrollbar(NULL),
-      d_vertScrollbar(NULL)
+      d_vertScrollbar(NULL),
+      openButtonImagery(NULL),
+      closeButtonImagery(NULL)
    {
       // add new events specific to list box.
       addTreeEvents();
 
       addTreeProperties();
-      // initialise();
    }
 
 
@@ -97,7 +98,13 @@
       resetList_impl();
    }
 
+    void Tree::setLookNFeel(const String& look)
+    {
+        Window::setLookNFeel( look );
+        initialise();
+    }
 
+
    /*************************************************************************
    Initialise the Window based object ready for use.
    *************************************************************************/

Posted: Thu Sep 06, 2007 21:54
by scriptkid
Thanks! Appreciated :) I will give it a go this weekend.

Posted: Fri Sep 14, 2007 14:41
by scriptkid
Applied and tested, thanks again! :)