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

Author Topic: [Android] sf::Mutex crash  (Read 2463 times)

0 Members and 1 Guest are viewing this topic.

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
[Android] sf::Mutex crash
« on: September 27, 2016, 05:50:05 pm »
Hi, I compiled my app on android and it crashed at the beginning. This is what I get while running ndk-dbg:
Thread 1 "thundergames.ki" received signal SIGSEGV, Segmentation fault.
0x5298f1a0 in sf::Mutex::lock() () from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/libsfml-system.so
 
Stacktrace:
#0  0x5298f1a0 in sf::Mutex::lock() () from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/libsfml-system.so
#1  0x5298f154 in sf::Lock::Lock(sf::Mutex&) () from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/libsfml-system.so
#2  0x529a133c in sf::priv::VideoModeImpl::getDesktopMode() ()
   from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/libsfml-window.so
#3  0x5299dd34 in sf::VideoMode::getDesktopMode() () from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/libsfml-window.so
#4  0x52c60c18 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at jni/main.cpp:9
#5  0x52c628b6 in _GLOBAL__sub_I_main.cpp(void) () at jni/main.cpp:143
#6  0x400d82d4 in _start () from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/system/bin/linker
#7  0x400da132 in ?? () from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/system/bin/linker
#8  0x51ef71c4 in loadLibrary(char const*, _JNIEnv*, _jobject*&) ()
   from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/libsfml-activity.so
#9  0x51ef7382 in ANativeActivity_onCreate () from /home/kamil/Pulpit/android/test1/obj/local/armeabi-v7a/libsfml-activity.so
#10 0x4025b8cc in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
 

I couldn't reproduce exact error using another code, but this one:
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
int main(int argc, char *argv[])
{
    sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "");

    sf::Mutex mutex;
    mutex.lock();
    mutex.unlock();

    sf::View view = window.getDefaultView();

    while (window.isOpen())
    {
        sf::Event event;

        while (window.pollEvent(event))
        {
            switch (event.type)
            {
                case sf::Event::Closed:
                    window.close();
                    break;
                case sf::Event::Resized:
                    view.setSize(event.size.width, event.size.height);
                    view.setCenter(event.size.width/2, event.size.height/2);
                    window.setView(view);
                    break;
            }
        }

        window.clear(sf::Color::White);
        window.display();
    }
}
 
Causes this:
0x4011a7ac in __futex_syscall3 ()
   from /home/kamil/Pulpit/android/sample/obj/local/armeabi-v7a/system/lib/libc.so
 

Do you have any idea how to fix this?
Thanks in advance.
« Last Edit: September 27, 2016, 05:55:28 pm by korczurekk »

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: [Android] sf::Mutex crash
« Reply #1 on: September 28, 2016, 04:42:00 am »
If i remember well sfml audio reproduce the sounds using threads, so sf::Mutex must be involved.

Try to play and audio file and see if your app crash.

Now i cannot test it, but if have a question ¿'main' is beeing called only once?
I would like a spanish/latin community...
Problems building for Android? Look here

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
Re: [Android] sf::Mutex crash
« Reply #2 on: September 28, 2016, 08:43:08 pm »
No, sf::Music was ok.
Probably my installation was broken, after recompiling everything from github@master it worked fine. Maybe I messed sth with my compiler.  ???