Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Crash on exit when using String2D  (Read 3210 times)

0 Members and 1 Guest are viewing this topic.

bepawuca

  • Newbie
  • *
  • Posts: 5
    • View Profile
Crash on exit when using String2D
« on: December 04, 2010, 11:08:20 pm »
Anything I write with SFML.NET 1.6 crashes on exit ('vshost.exe has stopped working' on Windows 7 and 'memory could not be read' on XP) if I create an instance of String2D at some point in the program, even in the sample included with the documentation. This problem also occurs when I do not draw the String2D to the screen, but only create it. I am using VS2005, and have added the csml-***.dll files under extlibs to bin\Debug and bin\Release, and added references to the .NET assemblies lib\sfml-***.dll.

Any ideas what might be going on? And, if not, are there any alternatives to String2D I could use?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Crash on exit when using String2D
« Reply #1 on: December 04, 2010, 11:23:51 pm »
It's a known bug. It shouldn't crash if you never use the default font.
Laurent Gomila - SFML developer

bepawuca

  • Newbie
  • *
  • Posts: 5
    • View Profile
Crash on exit when using String2D
« Reply #2 on: December 04, 2010, 11:39:27 pm »
I get the same crash even if I don't use the default font.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Crash on exit when using String2D
« Reply #3 on: December 04, 2010, 11:40:43 pm »
How do you create your String2Ds?
Laurent Gomila - SFML developer

bepawuca

  • Newbie
  • *
  • Posts: 5
    • View Profile
Crash on exit when using String2D
« Reply #4 on: December 05, 2010, 12:14:36 am »
Here's the full code, taken from the documentation sample:

Code: [Select]
using System;
using SFML.Audio;
using SFML.Window;
using SFML.Graphics;

namespace Example
{
    class Program
    {
        static void OnClose(object sender, EventArgs e)
        {
            // Close the window when OnClose event is received
            RenderWindow window = (RenderWindow)sender;
            window.Close();
        }

        static void Main(string[] args)
        {
            // Create the main window
            RenderWindow app = new RenderWindow(new VideoMode(800, 600), "SFML window");
            app.Closed += new EventHandler(OnClose);

            // Create a graphical string to display
            Font arial = new Font("arial.ttf");
            String2D text = new String2D("Hello SFML.Net", arial);

            // Start the game loop
            while (app.IsOpened())
            {
                // Process events
                app.DispatchEvents();

                // Clear screen
                app.Clear();;

                // Draw the string
                app.Draw(text);

                // Update the window
                app.Display();
            }
        }
    }
}


Naturally, I've put arial.ttf in the right place for it to work.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Crash on exit when using String2D
« Reply #5 on: December 05, 2010, 10:17:10 am »
Ok, seems like it's not the same bug. I don't think there's a workaround for this one, except switching to SFML 2.
Laurent Gomila - SFML developer

bepawuca

  • Newbie
  • *
  • Posts: 5
    • View Profile
Crash on exit when using String2D
« Reply #6 on: December 05, 2010, 03:13:27 pm »
Can I use SFML 2 with .NET 2.0 and VS2005?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Crash on exit when using String2D
« Reply #7 on: December 05, 2010, 08:38:05 pm »
Should be ok, yes.
Laurent Gomila - SFML developer

bepawuca

  • Newbie
  • *
  • Posts: 5
    • View Profile
Crash on exit when using String2D
« Reply #8 on: December 05, 2010, 10:24:48 pm »
I just tried it out and it works fine. Thanks for the help!

 

anything