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

Author Topic: Issue querying mouse position from SFML.Net, errors in native code  (Read 3489 times)

0 Members and 1 Guest are viewing this topic.

ben1066

  • Newbie
  • *
  • Posts: 7
    • View Profile
Hello,
I have quickly tried running my SFML.Net application on arch, and for the most part it works, however I have an issue which occurs when I enter the game state, exit it and enter it again. Upon restarting the game state I get an error the first time I attempt to get the mouse position.  The error I'm getting for mono is as follows:
[ben@arch Release]$ mono TopDown.exe
MenuState::Enter()
GameState::Initialize()
MenuState::Exit()
GameState::Enter()
GameState::Exit()
MenuState::Enter()
GameState::Initialize()
MenuState::Exit()
GameState::Enter()
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
mono: xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
Stacktrace:

  at (wrapper managed-to-native) SFML.Graphics.RenderWindow.sfMouse_getPositionRenderWindow (intptr) <0xffffffff>
  at SFML.Graphics.RenderWindow.InternalGetMousePosition () <0x00017>
  at SFML.Window.Mouse.GetPosition (SFML.Window.Window) <0x00018>
  at TopDown.GameState.Update (SFML.Graphics.RenderWindow) <0x000e7>
  at TopDown.StateManager.Update (SFML.Graphics.RenderWindow) <0x0004b>
  at TopDown.Program.Main (string[]) <0x004f7>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        mono() [0x4969f9]
        /usr/lib/libpthread.so.0(+0xf1a0) [0x7fac7a6151a0]
        /usr/lib/libc.so.6(gsignal+0x35) [0x7fac7a293fd5]
        /usr/lib/libc.so.6(abort+0x148) [0x7fac7a295458]
        /usr/lib/libc.so.6(+0x2e022) [0x7fac7a28d022]
        /usr/lib/libc.so.6(+0x2e0d2) [0x7fac7a28d0d2]
        /usr/lib/libX11.so.6(+0x4174c) [0x7fac7327074c]
        /usr/lib/libX11.so.6(_XReply+0x23b) [0x7fac7327182b]
        /usr/lib/libX11.so.6(XQueryPointer+0x69) [0x7fac732675a9]
        /usr/lib/libsfml-window.so.2(+0xbf34) [0x7fac78832f34]
        /usr/lib/libsfml-window.so.2(_ZN2sf5Mouse11getPositionERKNS_6WindowE+0x9) [0x7fac7882e489]
        /usr/lib/libcsfml-graphics.so.2(sfMouse_getPositionRenderWindow+0xe) [0x7fac78c8c66e]
        [0x40f1467b]

Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted (core dumped)
 

I am using SFML, CFSML and SFML.Net from Git as the Keyboard.A vs Keyboard.Unknown bug is a rather large issue for my application. It functions just fine on Windows with VS2012.

Thanks,
Ben.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issue querying mouse position from SFML.Net, errors in native code
« Reply #1 on: December 02, 2012, 08:39:24 am »
Quote
Most likely this is a multi-threaded client and XInitThreads has not been called
If it's not that, I don't know (SFML doesn't call XInitThreads).
Laurent Gomila - SFML developer

ben1066

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Issue querying mouse position from SFML.Net, errors in native code
« Reply #2 on: December 02, 2012, 02:03:13 pm »
I haven't touched anything in regards to threading, so I suppose I should report this to Mono?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issue querying mouse position from SFML.Net, errors in native code
« Reply #3 on: December 02, 2012, 02:40:44 pm »
Are you sure that no threads are involved in your code? What happens when you re-enter the game state?

It may also be an internal thread, and in this case there's probably no solution other than modifying SFML to add a call to XInitThreads.
Laurent Gomila - SFML developer

ben1066

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Issue querying mouse position from SFML.Net, errors in native code
« Reply #4 on: December 02, 2012, 06:19:02 pm »
Ah yes I am actually using threads because I'm using some asynchronous methods to implement a console, I forgot about that. Surely this makes it an SFML issue?
« Last Edit: December 02, 2012, 06:29:10 pm by ben1066 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issue querying mouse position from SFML.Net, errors in native code
« Reply #5 on: December 02, 2012, 06:20:16 pm »
Quote
Surely this makes it an SFML issue?
Absolutely.
Laurent Gomila - SFML developer

ben1066

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Issue querying mouse position from SFML.Net, errors in native code
« Reply #6 on: December 02, 2012, 06:29:35 pm »
I can confirm that calling XInitThreads fixes the issue, I have called it through P/Invoke and now everything works.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issue querying mouse position from SFML.Net, errors in native code
« Reply #7 on: December 02, 2012, 07:12:12 pm »
Ok. Thanks for your feedback.
Laurent Gomila - SFML developer