Wl_display@1: error 1: invalid arguments for qt_extended_surface

I’m trying to do some C++ / QML development and failing to get the debugging runs going. The app, after installed by the sdk does ‘work’. It will make an intro sound and the first QML page is displayed. Running from the SDK, for instance with an RPM deploy:

wl_display@1: error 1: invalid arguments for qt_extended_surface@25.set_content_orientation_mask
[C] unknown:0 - The Wayland connection experienced a fatal error (Invalid argument)
19:04:56: Application finished with exit code 1.

My main() looks like this:

QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));

makeAsound(); // regardless if this is called or not, crashes.

QTranslator *appTranslator = new QTranslator;
appTranslator->load("harbour-simplesynth-" + QLocale::system().name(), SailfishApp::pathTo("translations").path());

//qmlRegisterType<SoundGenerator>("de.poetaster.sailsynth", 1, 0, "SoundGenerator");
qmlRegisterType<Synthesizer>("de.poetaster.sailsynth", 1, 0, "Synthesizer");

QScopedPointer<QQuickView> view(SailfishApp::createView());

return app->exec();

If makeAsound() is called, this call succeeds (beep beep :wink: before the wayland crash.

And the makeAsound() function

void makeAsound() {

// initial instrument definition for testing
//string input = "fm 100 150 am 0 100 square 100:20 square 39 adsr 1:0 1000:0 2000:100 5001:100 6000:-100 8000:0 loop level 1";
//string input = "1000 fm 100 150 am 0 100";
string input = "fm 60 140 { fm 60 140 modulator sinus 200 sinus 10 } sinus 1";

long duration = 600;
uint32_t ech = 48000;
const int BUF_LENGTH = 1024;

//SoundGenerator::play(SoundGenerator::factory("fm 50 150 sinus 440 hook_speed"));

SoundGenerator* g = SoundGenerator::factory(input);

SoundGenerator::setVolume(0);   // Avoid sound clicks at start
SoundGenerator::setVolume(0);   // Avoid sound clicks at start

const int fade_time=50;

if (duration > fade_time) {
        SDL_Delay(duration-fade_time); // Play for ms
        SDL_Delay(fade_time); // Play for 100 ms (while fade out)
} else {
        SDL_Delay(fade_time); // Play for ms (while fading out)
SDL_Delay(1000); // Wait till the end of buffer is played (avoid clicks) TODO this is buffer size dependant


I sometimes (after disabling Orientation directives in the start qml) get:

eglplatform_wayland.cpp:193: EGLNativeWindowType waylandws_CreateWindow(EGLNativeWindowType, _EGLDisplay*): Assertion ret >= 0’`

did you try stat your appliaction from terminal?
i have same problem on my device, but setting

export WAYLAND_DISPLAY=../../display/wayland-0

helps me

once the app is on the device, it ‘just works’. It doesn’t matter if I run it from a terminal or not. At the moment I’m running it from the terminal to get std::out so I can do some debugging because the ide doesn’t work.

Running from a script:
invoker --type=silica-qt5 harbour-simplesynth -qmljsdebugger=port:10001,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation

the app runs. Only if I try to attach the QML debugger from the ide does it die. I tried your suggestion with a script that contains:

export WAYLAND_DISPLAY=../../display/wayland-0
qmlliveruntime-sailfish --update-on-connect /usr/bin/harbour-simplesynth 

but that get’s the same error (set_content_orientation…)

You’re also doing SDL2 game dev stuff?

yes, i do )
but for now, i was not develop any game, i just port already exists games (and some game engines) to SailfishOS

1 Like

Yeah! I looked at some of your ports while looking at instantiating SDL2 for audio. I found a strange (appropriate to me :slight_smile: library which actually works well. I have no idea why that would kill wayland, though!

This thing is just a stub, but it does actually work. you can feed a string generator definition to the synth class and it plays: GitHub - poetaster/harbour-simplesynth: A symple Audio Synth, using C++/SDL2

But it’s too simple to bother with. The problem now is that I actually need interactive development or I’m stuck. It’s way too many QML elements to just ‘build’ the interface and then test with a terminal. sigh.

did you try build and run some template project, or project from samples& is it work with QML debug, qmllive?

I maintain a bunch of apps that work with the full compliment, including qmllive debugging. Several are ‘pure QML’, two that work are in C++ and 3 use python.

It’s just this app. I think it might have to do with the structure of the static library I’m including …