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

Author Topic: Request.setField crashes in SFML V2.0 OSX 10.6.8  (Read 3353 times)

0 Members and 1 Guest are viewing this topic.

apollon0815

  • Newbie
  • *
  • Posts: 3
    • View Profile
Request.setField crashes in SFML V2.0 OSX 10.6.8
« on: May 23, 2012, 03:08:15 am »
Hello,

When code reaches Request.setField this error occurs:

malloc: *** error for object 0x7fff70431500: pointer being freed was not allocated.

Same thing in xcode 4.2. with attached code. Programm received signal: "SIGABRT" in 0x0000000100170b98

Regards
Mike

int main (int argc, const char * argv[])
{
    // Create a HTTP client
    sf::Http Http;
   
    // Connect it to www.whatismyip.org
    Http.setHost("www.whatismyip.org");
   
    // Prepare a request to retrieve the index page
    sf::Http::Request Request;
    Request.setMethod(sf::Http::Request::Get);
    Request.setUri("/");
    Request.setBody("");
    Request.setHttpVersion(1, 0);
    Request.setField("User-Agent" , "foobar");
   
    // Send it and get the response returned by the server
    std::cout << "Sending a request to www.whatismyip.org..." << std::endl;
    sf::Http::Response Page = Http.sendRequest(Request);
   
    // Display the response
    std::cout << "Response received from www.whatismyip.org." << std::endl
    << "Status code (should be 200 on success): " << Page.getStatus() << std::endl
    << "HTTP version: " << Page.getMajorHttpVersion() << "." << Page.getMinorHttpVersion() << std::endl
    << "Returned message (should be your IP address or an error message): " << Page.getBody() << std::endl;
   
    // Wait until the user presses 'enter' key
    std::cout << "Press enter to exit..." << std::endl;
    std::cin.ignore(10000, '\n');
   
    return EXIT_SUCCESS;
}
 

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Request.setField crashes in SFML V2.0 OSX 10.6.8
« Reply #1 on: May 23, 2012, 09:41:18 am »
How did you get SFML ? Did you compile it yourself ? If yes, did you manage to fix issue 5 as explained on github ?
SFML / OS X developer

apollon0815

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Request.setField crashes in SFML V2.0 OSX 10.6.8
« Reply #2 on: May 23, 2012, 02:29:23 pm »
Hello,

It is the RC.

Last time I used C++ in a serious projekt is 10 years ago. So my knowledge is rusty and I would prefer to avoid compiling sfml myself.

Is Issue 5 the same error?

regards
Mike

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Request.setField crashes in SFML V2.0 OSX 10.6.8
« Reply #3 on: May 23, 2012, 02:35:36 pm »
If you downloaded the RC then issue 5 should not be a problem (your problem looks like this issue but it's probably something else).

Could you give us the stacktrace of your application when the error occurs ?
SFML / OS X developer

apollon0815

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Request.setField crashes in SFML V2.0 OSX 10.6.8
« Reply #4 on: May 23, 2012, 03:40:30 pm »
Hope this is a stacktrace. ;-)

0x0000000100170b10  <+0000>  push   %rbp
0x0000000100170b11  <+0001>  mov    %rsp,%rbp
0x0000000100170b14  <+0004>  push   %r15
0x0000000100170b16  <+0006>  push   %r14
0x0000000100170b18  <+0008>  push   %rbx
0x0000000100170b19  <+0009>  sub    $0x38,%rsp
0x0000000100170b1d  <+0013>  mov    %rdx,%r14
0x0000000100170b20  <+0016>  mov    %rdi,%r15
0x0000000100170b23  <+0019>  lea    -0x48(%rbp),%rdi
0x0000000100170b27  <+0023>  callq  0x100177884 <dyld_stub__ZNSsC1ERKSs>
0x0000000100170b2c  <+0028>  mov    -0x48(%rbp),%rax
0x0000000100170b30  <+0032>  cmpl   $0x0,-0x8(%rax)
0x0000000100170b34  <+0036>  mov    %rax,%rbx
0x0000000100170b37  <+0039>  js     0x100170b50 <_ZN2sf4Http7Request8setFieldERKSsS3_+64>
0x0000000100170b39  <+0041>  lea    -0x48(%rbp),%rdi
0x0000000100170b3d  <+0045>  callq  0x10017782a <dyld_stub__ZNSs12_M_leak_hardEv>
0x0000000100170b42  <+0050>  mov    -0x48(%rbp),%rax
0x0000000100170b46  <+0054>  mov    %rax,%rbx
0x0000000100170b49  <+0057>  nopl   0x0(%rax)
0x0000000100170b50  <+0064>  cmpl   $0x0,-0x8(%rax)
0x0000000100170b54  <+0068>  js     0x100170b63 <_ZN2sf4Http7Request8setFieldERKSsS3_+83>
0x0000000100170b56  <+0070>  lea    -0x48(%rbp),%rdi
0x0000000100170b5a  <+0074>  callq  0x10017782a <dyld_stub__ZNSs12_M_leak_hardEv>
0x0000000100170b5f  <+0079>  mov    -0x48(%rbp),%rax
0x0000000100170b63  <+0083>  add    -0x18(%rax),%rax
0x0000000100170b67  <+0087>  cmp    %rax,%rbx
0x0000000100170b6a  <+0090>  je     0x100170b7f <_ZN2sf4Http7Request8setFieldERKSsS3_+111>
0x0000000100170b6c  <+0092>  movsbl (%rbx),%edi
0x0000000100170b6f  <+0095>  callq  0x100177728 <dyld_stub___tolower>
0x0000000100170b74  <+0100>  mov    %al,(%rbx)
0x0000000100170b76  <+0102>  inc    %rbx
0x0000000100170b79  <+0105>  mov    -0x48(%rbp),%rax
0x0000000100170b7d  <+0109>  jmp    0x100170b50 <_ZN2sf4Http7Request8setFieldERKSsS3_+64>
0x0000000100170b7f  <+0111>  lea    -0x40(%rbp),%rdi
0x0000000100170b83  <+0115>  lea    -0x48(%rbp),%rsi
0x0000000100170b87  <+0119>  callq  0x100177884 <dyld_stub__ZNSsC1ERKSs>
0x0000000100170b8c  <+0124>  lea    -0x40(%rbp),%rsi
0x0000000100170b90  <+0128>  mov    %r15,%rdi
0x0000000100170b93  <+0131>  callq  0x1001730c0  

0x0000000100170b98  <+0136>  mov    %rax,%rdi   <= Here it shows me Signal receipt "SIGABRT"

0x0000000100170b9b  <+0139>  mov    %r14,%rsi
0x0000000100170b9e  <+0142>  callq  0x10017785a <dyld_stub__ZNSs6assignERKSs>
0x0000000100170ba3  <+0147>  mov    -0x40(%rbp),%rdi
0x0000000100170ba7  <+0151>  mov    $0xffffffff,%ebx
0x0000000100170bac  <+0156>  mov    $0xffffffff,%eax
0x0000000100170bb1  <+0161>  lock xadd %eax,-0x8(%rdi)
0x0000000100170bb6  <+0166>  test   %eax,%eax
0x0000000100170bb8  <+0168>  jg     0x100170bc7 <_ZN2sf4Http7Request8setFieldERKSsS3_+183>
0x0000000100170bba  <+0170>  add    $0xffffffffffffffe8,%rdi
0x0000000100170bbe  <+0174>  lea    -0x38(%rbp),%rsi
0x0000000100170bc2  <+0178>  callq  0x100177836 <dyld_stub__ZNSs4_Rep10_M_destroyERKSaIcE>
0x0000000100170bc7  <+0183>  mov    -0x48(%rbp),%rdi
0x0000000100170bcb  <+0187>  lock xadd %ebx,-0x8(%rdi)
0x0000000100170bd0  <+0192>  test   %ebx,%ebx
0x0000000100170bd2  <+0194>  jg     0x100170be1 <_ZN2sf4Http7Request8setFieldERKSsS3_+209>
0x0000000100170bd4  <+0196>  add    $0xffffffffffffffe8,%rdi
0x0000000100170bd8  <+0200>  lea    -0x30(%rbp),%rsi
0x0000000100170bdc  <+0204>  callq  0x100177836 <dyld_stub__ZNSs4_Rep10_M_destroyERKSaIcE>
0x0000000100170be1  <+0209>  add    $0x38,%rsp
0x0000000100170be5  <+0213>  pop    %rbx
0x0000000100170be6  <+0214>  pop    %r14
0x0000000100170be8  <+0216>  pop    %r15
0x0000000100170bea  <+0218>  pop    %rbp
0x0000000100170beb  <+0219>  retq  
0x0000000100170bec  <+0220>  mov    %rax,%rbx
0x0000000100170bef  <+0223>  jmp    0x100170c18 <_ZN2sf4Http7Request8setFieldERKSsS3_+264>
0x0000000100170bf1  <+0225>  mov    %rax,%rbx
0x0000000100170bf4  <+0228>  jmp    0x100170c18 <_ZN2sf4Http7Request8setFieldERKSsS3_+264>
0x0000000100170bf6  <+0230>  mov    %rax,%rbx
0x0000000100170bf9  <+0233>  mov    -0x40(%rbp),%rdi
0x0000000100170bfd  <+0237>  mov    $0xffffffff,%eax
0x0000000100170c02  <+0242>  lock xadd %eax,-0x8(%rdi)
0x0000000100170c07  <+0247>  test   %eax,%eax
0x0000000100170c09  <+0249>  jg     0x100170c18 <_ZN2sf4Http7Request8setFieldERKSsS3_+264>
0x0000000100170c0b  <+0251>  add    $0xffffffffffffffe8,%rdi
0x0000000100170c0f  <+0255>  lea    -0x28(%rbp),%rsi
0x0000000100170c13  <+0259>  callq  0x100177836 <dyld_stub__ZNSs4_Rep10_M_destroyERKSaIcE>
0x0000000100170c18  <+0264>  mov    -0x48(%rbp),%rdi
0x0000000100170c1c  <+0268>  mov    $0xffffffff,%eax
0x0000000100170c21  <+0273>  lock xadd %eax,-0x8(%rdi)
0x0000000100170c26  <+0278>  test   %eax,%eax
0x0000000100170c28  <+0280>  jg     0x100170c37 <_ZN2sf4Http7Request8setFieldERKSsS3_+295>
0x0000000100170c2a  <+0282>  add    $0xffffffffffffffe8,%rdi
0x0000000100170c2e  <+0286>  lea    -0x20(%rbp),%rsi
0x0000000100170c32  <+0290>  callq  0x100177836 <dyld_stub__ZNSs4_Rep10_M_destroyERKSaIcE>
0x0000000100170c37  <+0295>  mov    %rbx,%rdi
0x0000000100170c3a  <+0298>  callq  0x10017770a <dyld_stub__Unwind_Resume>
0x0000000100170c3f  <+0303>  nop    

regards
Mike

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Request.setField crashes in SFML V2.0 OSX 10.6.8
« Reply #5 on: May 23, 2012, 03:43:34 pm »
argg! sorry! I meant backtrace... not stacktrace...
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Request.setField crashes in SFML V2.0 OSX 10.6.8
« Reply #6 on: May 23, 2012, 04:01:04 pm »
Quote
argg! sorry! I meant backtrace... not stacktrace...
It's the same :)

apollon0815: http://en.wikipedia.org/wiki/Stack_trace
Laurent Gomila - SFML developer