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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ErikPerik

Pages: [1] 2
1
Network / GDB: Pointer being freed was not allocated
« on: November 07, 2010, 09:46:08 pm »
@Hiura: This did not solve the problem for me. It can be that I applied the setting incorrectly (I added the line _GLIBCXX_FULLY_DYNAMIC_STRING=1 to the "Preprocessor macros" in the target settings Build tab, like it said). Unfortunately.

And I did not get GDB to print out the contents of the Length variable.

2
Network / GDB: Pointer being freed was not allocated
« on: November 05, 2010, 08:06:01 pm »
I'm having trouble viewing the contents of that specific variable, it appears that it is out of context for the debugger.

Ignoring the Xcode GUI and only using the GDB console I have added a breakpoint at "Packet >> mess;" and used the command "up" to set the current context to "#6  0x000add0e in sf::Packet::operator>> ()", and from there I should be able to "print Length", but it says "No symbol "Length" in current context.".

And in the GUI that particular method (and all above it) (talking about #6   0x000add0e in sf::Packet::operator>>), when I have selected it, I can't view Local variables, only "Globals" and "Registers". Any ideas?

3
Network / GDB: Pointer being freed was not allocated
« on: November 05, 2010, 07:04:25 pm »
I am a bit new to debuggin with GDB, how would I go about getting the value of the Length variable, when I have put a breakpoint over the "Packet >> mess;"-line?

4
Network / GDB: Pointer being freed was not allocated
« on: November 05, 2010, 06:16:49 pm »
Which Length variable do you mean? I printed the value of "Packet.GetDataSize()" for the received string "Hello world" and got 15, and "Hello world".size() which is 11. Could this be of interest?

I'm thinking it might be that you're memcpy:ing the data in operator>> for char-arrays but only assigning the raw data for std::strings, but this might be handled automatically by std::string itself?

5
Network / GDB: Pointer being freed was not allocated
« on: November 05, 2010, 05:21:05 pm »
I don't know how to copy the stacktrace, but here is what I get when I set the breakpoint: "malloc_error_break"



The error appears to originate from the assign:ment of the string to my string inside Packet's operator>>. Any ideas?

EDIT: The error disappears if I replace the "std::string mess" with "char foo[300]", so it must be an error in how Packet takes care of std::string.

6
Network / GDB: Pointer being freed was not allocated
« on: November 05, 2010, 04:50:51 pm »
I just downloaded the example from the tutorials on SFML 1.6 on networks and selectors and it compiles and runs fine on my Macbook using Xcode. However, when I have connected a client and start sending messages to the server, I get the following message from GDB (From the server):

Quote
*** set a breakpoint in malloc_error_break to debug
Server(1447) malloc: *** error for object 0xa0061db0: pointer being freed was not allocated


The error appears to originate from this line:

Code: [Select]

// Else, it is a client socket so we can read the data he sent
                sf::Packet Packet;
                if (Socket.Receive(Packet) == sf::Socket::Done)
                {
// Extract the message and display it
                    std::string mess;
                    Packet >> mess;
                    std::cout << "A client says: \"" << Message << "\"" << std::endl;


To be more precise, when this line is present:

Code: [Select]
Packet >> mess;

I have not made any other alterations to the code posted here: http://www.sfml-dev.org/tutorials/1.6/sources/network-packets.cpp

Is this a bug in SFML 1.6?

7
General / UTF32String and sf::String not displaying ALL characters
« on: October 04, 2010, 10:51:52 pm »
But if I plan to use the font for a chat in a game, I would need a lot of characters. And that would be one huge table. And maybe I would like to mix both chinese and latin characters?

If I get this correct: The charset you specify to LoadFromFile is a list of all characters that you want to use for that font. What it does is to load those characters into memory, so the reason not all characters are loaded from the beginning is because it would take huge amounts of memory: 4*2^32 bytes = 16 gb? But the all the characters ARE available (if the font has them), only not loaded. And that is what the charset does. Am I correct?

8
General / UTF32String and sf::String not displaying ALL characters
« on: October 04, 2010, 09:49:32 pm »
There must be somewhere where one can download tables of these charsets? And how do I see what characters the default one defines?

9
General / UTF32String and sf::String not displaying ALL characters
« on: October 04, 2010, 08:30:32 pm »
What happens if I don't specify a charset then? And if I specify a charset, shouldn't I have to specify the entire alphabet and everything in between? Or do I just specify "special" characters (as in the example, a couple chinese characters)?

10
General / UTF32String and sf::String not displaying ALL characters
« on: October 04, 2010, 06:00:03 pm »
This line.

Code: [Select]
sf::Uint32 MyCharset[] = {0x4E16, 0x754C, 0x60A8, 0x597D, 0x0}; // a set of unicode chinese characters

It defines a charset. Why does it have to be a set of chinese characters, what do they mean in the context? I know that there are a number of different charsets ISO-8859, UTF-32/, etc, what does it mean?

11
General / UTF32String and sf::String not displaying ALL characters
« on: October 04, 2010, 04:51:23 pm »
Is there a tutorial in defining charsets? Or somewhere where I can find a list of them. By that I mean the UTF32-array used in sf::Font::LoadFromFile and that is used on http://www.sfml-dev.org/tutorials/1.6/graphics-fonts.php

Code: [Select]
sf::Font   MyFont;
sf::Uint32 MyCharset[] = {0x4E16, 0x754C, 0x60A8, 0x597D, 0x0}; // a set of unicode chinese characters
if (!MyFont.LoadFromFile("arial.ttf", 50, MyCharset))
{
    // Error...
}

12
Graphics / Hide overflown contents from a set boundary
« on: September 24, 2010, 06:00:40 pm »
I am currently using this:

Code: [Select]

void drawBoundary(sf::RenderWindow &window, sf::Drawable *d, const sf::FloatRect &boundary)
{
GLdouble eq1[] = {1, 0, 0, 0x0};
GLdouble eq2[] = {-1, 0, 0, 0x0};
GLdouble eq3[] = {0, 1, 0, 0x0};
GLdouble eq4[] = {0, -1, 0, 0x0};

eq1[3] = -boundary.Left;
eq2[3] = boundary.Right;
eq3[3] = -boundary.Top;
eq4[3] = boundary.Bottom;

glEnable(GL_CLIP_PLANE0);
glEnable(GL_CLIP_PLANE1);
glEnable(GL_CLIP_PLANE2);
glEnable(GL_CLIP_PLANE3);
glClipPlane(GL_CLIP_PLANE0, eq1);
glClipPlane(GL_CLIP_PLANE1, eq2);
glClipPlane(GL_CLIP_PLANE2, eq3);
glClipPlane(GL_CLIP_PLANE3, eq4);

window.Draw(*d);

glDisable(GL_CLIP_PLANE1);
glDisable(GL_CLIP_PLANE0);
glDisable(GL_CLIP_PLANE2);
glDisable(GL_CLIP_PLANE3);
}


Edit: Fixed the function

13
Graphics / Hide overflown contents from a set boundary
« on: September 24, 2010, 05:25:08 pm »
From what I've read in recent thread it has problems with ATI-cards?

14
Graphics / Hide overflown contents from a set boundary
« on: September 23, 2010, 09:16:25 pm »
Quote from: "Lupinius"
You could render the text to a RenderImage and use subrect to only draw one part of the text.


But RenderImage is 2.0 and I'm using 1.6 (because I like stability).

15
Graphics / Hide overflown contents from a set boundary
« on: September 23, 2010, 08:21:27 pm »
Yes, that is exactly what I want. Is this the "recommended" way of dealing with it? As I don't know french I can't really decipher everything in the linked thread by NoIdea, but see the gist of it.

Code: [Select]

glEnable(GL_SCISSOR_TEST);
...
// Draw code
...
glDisable(GL_SCISSOR_TEST);


Is this what's recommended?

Pages: [1] 2