Crash when using SetFontHeight?

jonathanc

29-10-2009 22:01:17

Hi all,

Haven't been using myGui for a while but I have recently updated it. I have an old project which was compiled using the old version of MyGUI. I have updated everything and also updated the version of OGRE to the latest one.

I noticed however my program will crash if I try to call setFontHeight function. This is an example of my code :

livesText = mGUI->createWidget<MyGUI::StaticText>("StaticText",24, 30, 168, 60, MyGUI::ALIGN_DEFAULT, "Main");
livesText->setTextColour(ColourValue(1.0, 0.0, 0.0));
//livesText->setFontHeight(28);
livesText->setCaption("Player Lives : " + StringConverter::toString(pManager->getLives()));


The program crashes in the line which I have commented out. If I comment that line out the text will not be rendered. Can anyone please tell me what did I do wrong? Thanks.

jonathanc

29-10-2009 22:23:50

Ok, I managed to get rid of the crash if I change from using "StaticText" to "StaticText1" (just as a test).

However, nothing is rendered on the screen.

my.name

30-10-2009 03:14:21

log?

jonathanc

30-10-2009 10:39:04

log?

Hi, this is my log. I don't really see anything suspicious but I may be wrong :

----------------------------------------------------------------------------------------------------------------------------------
loging report for : 10/29/2009 23:15:20
----------------------------------------------------------------------------------------------------------------------------------

23:15:20 | General | Info | * Initialise: Gui | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_gui.cpp | 54
23:15:20 | General | Info | * MyGUI version 2.2.3 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_gui.cpp | 58
23:15:20 | General | Info | Viewport : 1024 768 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_gui.cpp | 68
23:15:20 | General | Info | * Initialise: ResourceManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 41
23:15:20 | General | Info | ResourceManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 53
23:15:20 | General | Info | * Initialise: LayerManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_layermanager.cpp | 41
23:15:20 | General | Info | LayerManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_layermanager.cpp | 73
23:15:20 | General | Info | * Initialise: WidgetManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 62
23:15:20 | General | Info | * Register widget factory 'Widget' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Button' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Window' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'List' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'HScroll' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'VScroll' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Edit' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'ComboBox' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'StaticText' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Tab' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'TabItem' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'TabItem' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Sheet' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Progress' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'ItemBox' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'MultiList' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'StaticImage' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Message' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'RenderBox' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'MenuCtrl' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'MenuItem' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'PopupMenu' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'MenuBar' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'ScrollView' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'DDContainer' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | * Register widget factory 'Canvas' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 118
23:15:20 | General | Info | WidgetManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_widgetmanager.cpp | 93
23:15:20 | General | Info | * Initialise: InputManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_inputmanager.cpp | 51
23:15:20 | General | Info | InputManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_inputmanager.cpp | 74
23:15:20 | General | Info | * Initialise: SubWidgetManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_subwidgetmanager.cpp | 33
23:15:20 | General | Info | SubWidgetManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_subwidgetmanager.cpp | 49
23:15:20 | General | Info | * Initialise: SkinManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_skinmanager.cpp | 40
23:15:20 | General | Info | SkinManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_skinmanager.cpp | 46
23:15:20 | General | Info | * Initialise: FontManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_fontmanager.cpp | 44
23:15:20 | General | Info | FontManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_fontmanager.cpp | 48
23:15:20 | General | Info | * Initialise: ControllerManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_controllermanager.cpp | 36
23:15:20 | General | Info | ControllerManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_controllermanager.cpp | 40
23:15:20 | General | Info | * Initialise: PointerManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_pointermanager.cpp | 41
23:15:20 | General | Info | PointerManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_pointermanager.cpp | 50
23:15:20 | General | Info | * Initialise: ClipboardManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_clipboardmanager.cpp | 35
23:15:20 | General | Info | ClipboardManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_clipboardmanager.cpp | 44
23:15:20 | General | Info | * Initialise: LayoutManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_layoutmanager.cpp | 41
23:15:20 | General | Info | LayoutManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_layoutmanager.cpp | 47
23:15:20 | General | Info | * Initialise: DynLibManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_dynlibmanager.cpp | 34
23:15:20 | General | Info | DynLibManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_dynlibmanager.cpp | 36
23:15:20 | General | Info | * Initialise: PluginManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_pluginmanager.cpp | 36
23:15:20 | General | Info | PluginManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_pluginmanager.cpp | 40
23:15:20 | General | Info | * Initialise: LanguageManager | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_languagemanager.cpp | 37
23:15:20 | General | Info | LanguageManager successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_languagemanager.cpp | 44
23:15:20 | General | Info | Load ini file 'core_keyboard.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Load ini file 'core_language.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Load ini file 'core_layer.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Load ini file 'core_font.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Load ini file 'core_theme.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Load ini file 'core_resource.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Load ini file 'core_skin.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Register value : 'HCenter' = 0 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 164
23:15:20 | General | Info | Register value : 'VCenter' = 0 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 165
23:15:20 | General | Info | Register value : 'Center' = 0 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 166
23:15:20 | General | Info | Register value : 'Left' = 2 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 167
23:15:20 | General | Info | Register value : 'Right' = 4 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 168
23:15:20 | General | Info | Register value : 'HStretch' = 6 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 169
23:15:20 | General | Info | Register value : 'Top' = 8 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 170
23:15:20 | General | Info | Register value : 'Bottom' = 16 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 171
23:15:20 | General | Info | Register value : 'VStretch' = 24 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 172
23:15:20 | General | Info | Register value : 'Stretch' = 30 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 173
23:15:20 | General | Info | Register value : 'Default' = 10 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\include\mygui_align.h | 174
23:15:20 | General | Info | Load ini file 'core_pointer.xml' from resource group : General | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_resourcemanager.cpp | 171
23:15:20 | General | Info | Gui successfully initialized | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_gui.cpp | 112
23:15:20 | General | Info | load layout 'introstate.layout' | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_layoutmanager.cpp | 72
23:15:20 | General | Info | Font 'Default' using texture size 512 x 256 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_font.cpp | 218
23:15:20 | General | Info | Font 'Default' using real height 17 pixels | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_font.cpp | 219
23:15:20 | General | Info | Font 'BattleStar' using texture size 1024 x 512 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_font.cpp | 218
23:15:20 | General | Info | Font 'BattleStar' using real height 38 pixels | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_font.cpp | 219
23:15:20 | General | Info | Font 'DejaVuSans.17' using texture size 256 x 256 | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_font.cpp | 218
23:15:20 | General | Info | Font 'DejaVuSans.17' using real height 17 pixels | c:\mygui2.2.3_source\mygui2.2.3_source\myguiengine\src\mygui_font.cpp | 219

my.name

30-10-2009 16:01:14

//test
livesText = mGUI->createWidget<MyGUI::StaticText>("StaticText",24, 30, 168, 60, MyGUI::ALIGN_DEFAULT, "Main");
livesText->setFontName("DejaVuSans.17");
livesText->setFontHeight(28);

jonathanc

30-10-2009 23:06:45

Hi,

Sorry for the late reply. I was very busy :(

Anyway, I tested your code. It has this error now :

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

It failed at this line : livesText->setFontName("DejaVuSans.17");

livesText was declared as : MyGUI::StaticTextPtr livesText;

my.name

31-10-2009 00:07:57

Take demo and try in it.

jonathanc

31-10-2009 12:56:57

Hmmm, sorry I didn't quite understand there. You mean try your code in the demo?

edit: I think I might have compiled 2.2.3 in correctly. I deleted it and now trying to recompile. All I have to do is link the OgreSDK paths before compiling? I had a read at the wiki but I don't quite understand.

Sorry.

my.name

31-10-2009 13:28:47

try Demo_Font

jonathanc

31-10-2009 14:13:45

Ok. One question though, when I try to recompile MyGUI at the end there's an option asking me to specify name of the executable file to be used for the debug session. I never had this before. Is it because MyGUIEngine is a library and I am trying to build a library so it's asking to link to a program like FontDemo.exe etc?

Right, silly question but I really have to ask. I have downloaded the ZIP/archive file. And according to the wiki :

Compiling
Building sources from archive

Please confirm you have configured the Ogre successfully. If not, you'll need to add the path to the OGRE includes and libs. Right click MyGUIEngine and compile it! You also can compile the demos and the tools if you want to.


So what I did was make sure MyGUIEngine is set as the Startup Project, link all the OGRE requirements in and hit F5 to compile. By doing this I get the pop up asking me to specify name of exe file.

jonathanc

31-10-2009 14:41:25

Right, I compiled demo font and ran it. It runs fine. But when I try to do the same to my project I get the same error above.

I also used MyGUI for buttons during my Intro stage and that worked fine. The tickbox worked fine too. It just don't like rendering the text.

my.name

01-11-2009 01:29:29

Take the minimum demo and transfer it to the project

jonathanc

01-11-2009 02:02:03

Hmmm, you mean take what I can from the demo and put it into my project?

my.name

01-11-2009 15:06:34

please wait ...

jonathanc

01-11-2009 17:41:03

Ok. Thank you very much. I could provide more of the code if you need.

my.name

04-11-2009 18:46:07

run app in Debug mode (F5)
show screenshot (stack trace and exception)

jonathanc

12-11-2009 12:24:40

Ok here are the Screenshots. Are these what you want?





This is the bit that cut cut out due to width :



I could forward you some of the code in PM if you need. Thank you very much.

my.name

12-11-2009 12:59:36

Debug build?
version Visual Studio
CRT DLL? (Project Property -> Configuration Propertyies->C/C++->Code Generation->Runtime Library->?)

jonathanc

13-11-2009 23:41:16

Hi,

Yes, I am in Debug mode.
I'm using MS Visual C++ 2005 version 8
Runtime library is Multi-threaded Debug DLL (/MDd)

jonathanc

19-11-2009 16:47:05

No idea why? :(

my.name

19-11-2009 21:42:31

This happens when dll interfaces doesn't match. For example when it was built for release libraries and you using debug libraries.

Also it is possible when when too much memory is used on the call stack (stack overflow). To fix this you should do next things:
- rebuild all used libraries in new place (OGRE, OIS, MyGUI, etc.)
- check all library directories paths, also make sure that you using new compiled libraries and not old (remove old libraries before recompileng to be sure that they wasn't used).
In worst case try to find your problem using BoundsChecker or similar tool.

jonathanc

24-11-2009 15:01:34

This happens when dll interfaces doesn't match. For example when it was built for release libraries and you using debug libraries.

Also it is possible when when too much memory is used on the call stack (stack overflow). To fix this you should do next things:
- rebuild all used libraries in new place (OGRE, OIS, MyGUI, etc.)
- check all library directories paths, also make sure that you using new compiled libraries and not old (remove old libraries before recompileng to be sure that they wasn't used).
In worst case try to find your problem using BoundsChecker or similar tool.


Hi,

Thanks for the reply. I think I have downloaded the pre-built files. I will download the source and rebuild it I guess.

jonathanc

30-11-2009 18:56:54

Hi,

Can I confirm if I am doing the right thing? I can't seem to get the code to work.

I have an old project that was compiled and built using the older version of OGRE and also an earlier version version of MyGUI. I have deleted the old OGRE and myGUI from my system. What I did next is download and rebuild OGRE. Next I downloaded the prebuilt MyGUI but it didn't work. So I guess I must try to download the source of MyGUI and rebuild it as well and then recompiled my whole project?

Thank you for patience.