Game Development Community

Memory Alloc Exception after using LangTable

by JohnT · in Torque Game Engine · 06/11/2006 (1:32 pm) · 3 replies

Just wondering if anyone has been playing around with the new Localization code in 1.4 and if so if they are having any problems as the program is exiting?

I have the Localization code working correctly except that when I exit the app, the destructor for LangTable is causing an Assert on line 190 in file lang.cc.


The message that I'm getting is:

Fatal: (c:\documents and settings\owner\desktop\dev\engine\platform\platformmemory.cc @ 1038)
Array alloc mismatch.

#1
06/12/2006 (7:14 am)
Hmm, thought I had this thing working correctly(minus the exception on shutdown).

I'm noticing if I set a Text control as below in a popup dialog, everthing works perfectly. Unfortunately, if I put the same control in the main menu, nothing shows up.

new GuiTextCtrl() {
      Profile = "GuiTextProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      Position = "233 206";
      Extent = "146 22";
      MinExtent = "8 2";
      Visible = "1";
      textID = "STR_TESTSTR1";
      maxLength = "255";
   };

Hope someone has an idea what's going on here!

Thanks,
John
#2
06/12/2006 (8:46 am)
I've submitted a patch for HEAD to fix the localization stuff since there is some code missing in the engine and in scripts currently which makes it kinda hard to use... but I don't think its in CVS Head yet :(

The fix for the crash is to use SAFE_DELETE_ARRAY instead of SAFE_DELETE here:
LangFile::~LangFile()
{
...
   SAFE_DELETE_ARRAY(mLangName);
   SAFE_DELETE_ARRAY(mLangFile);
...
}
As for your GuiTextCtrl, you also need to set the current mod inside the gui element or its parent like so:
langTableMod = "starter.fps";
For further details, see: tdn.garagegames.com/wiki/TorqueLocalization
#3
06/12/2006 (9:16 am)
@Stefan,

Both items above fixed my problems. (Guess I should have read a little closer, completely missed the langTableMod ).

Thank You! I was almost getting ready to give up and go create a monster switch statement instead.

John