nhielost / obs-midi-mg

Allows MIDI devices to interact with OBS Studio.
GNU General Public License v2.0
154 stars 9 forks source link

Fails on startup "Must construct a QApplication before a QWidget" #119

Open revpriest opened 8 months ago

revpriest commented 8 months ago

I am seeing this error when I try and start obs with the plugin installed.

Running in XFCE4 on Debian, obs-studio at version 29.0.2+dfsg-1+b1.

Installed the plugin from the .deb file obs-midi-mg-3.0.0-x86_64-linux-gnu.deb

More from the log:

warning: Failed to load 'en-GB' text for module: 'obs-midi-mg.so'
info: [obs-midi-mg] Loading plugin (v3.0.0)...
info: [obs-midi-mg] [Configuration] Initializing MIDI...
info: [obs-midi-mg] [Configuration] MIDI initialized.
info: [obs-midi-mg] [Configuration] Loading configuration...
info: [obs-midi-mg] [Configuration] Configuration file not found. Loading new configuration data...
info: [obs-midi-mg] [Configuration] Configuration file data loaded. Extracting...
info: [obs-midi-mg] [MIDI] {WARNING} midi_in_dummy: This class provides no functionality.
info: [obs-midi-mg] [MIDI] {WARNING} midi_out_dummy: This class provides no functionality.
info: [obs-midi-mg] [MIDI] {WARNING} midi_out_dummy: This class provides no functionality.
qt.core.qobject.connect: QObject::disconnect: Unexpected nullptr parameter
qt.core.qobject.connect: QObject::disconnect: Unexpected nullptr parameter
qt.core.qobject.connect: QObject::disconnect: Unexpected nullptr parameter
info: [obs-midi-mg] [Configuration] Configuration loading complete.
info: [obs-midi-mg] Loading plugin using the Echo style...
QWidget: Must construct a QApplication before a QWidget
Aborted

Presumably the nullptr errors mean that the application isn't constructed, but I dunno what would be causing them.

Obs works again when the plugin is removed.

Same issue when running as root so presumably not a permissions type issue.

Same thing with older beta 1 and with V 2.3.0

Found this closed issue [ https://github.com/nhielost/obs-midi-mg/issues/55 ] but the autoclose bot said to start a new one.

revpriest commented 7 months ago

I saw there was a newer version around so thought I'd try. Slightly different output, but same error at the end.

V3.0.0:

warning: Failed to load 'en-GB' text for module: 'obs-midi-mg.so'
info: [obs-midi-mg] Loading plugin (v3.0.0)...
info: [obs-midi-mg] [Configuration] Initializing MIDI...
info: [obs-midi-mg] [Configuration] MIDI initialized.
info: [obs-midi-mg] [Configuration] Loading configuration...
info: [obs-midi-mg] [Configuration] Configuration file not found. Loading new configuration data...
info: [obs-midi-mg] [Configuration] Configuration file data loaded. Extracting...
info: [obs-midi-mg] [Configuration] Configuration file data extraction complete.
info: [obs-midi-mg] [Configuration] Configuration loading complete. 
info: [obs-midi-mg] Loading plugin using the Echo style...
QWidget: Must construct a QApplication before a QWidget
Aborted

With V3.0.2 we get extra lines:

warning: Failed to load 'en-GB' text for module: 'obs-midi-mg.so'
info: [obs-midi-mg] Loading plugin (v3.0.2)...
info: [obs-midi-mg] [Configuration] Initializing MIDI...
info: [obs-midi-mg] [MIDI] Device <Midi Through Port-0> detected.
info: [obs-midi-mg] [MIDI] Device <SZ-MINICONTROL MIDI 1> detected.
info: [obs-midi-mg] [Configuration] MIDI initialized.
info: [obs-midi-mg] [Configuration] Loading configuration...
info: [obs-midi-mg] [Configuration] Configuration file not found. Loading new configuration data...
info: [obs-midi-mg] [Configuration] Configuration file data loaded. Extracting...
info: [obs-midi-mg] [Configuration] Configuration loading complete. 
info: [obs-midi-mg] Loading plugin using the Echo style...
QWidget: Must construct a QApplication before a QWidget
Aborted

I wondered about trying to build it and get more information. I managed to cmake to build the project, but then the actual make is saying

/home/pre/src/obs-midi/obs-midi-mg/libremidi/include/libremidi/writer.cpp: In member function ‘void libremidi::writer::write(std::ostream&) const’:
/home/pre/src/obs-midi/obs-midi-mg/libremidi/include/libremidi/writer.cpp:205:30: error: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Werror=conversion]
  205 |   util::write_uint16_be(out, ticksPerQuarterNote);
      |                              ^~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [libremidi/CMakeFiles/libremidi.dir/build.make:216: libremidi/CMakeFiles/libremidi.dir/include/libremidi/writer.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: libremidi/CMakeFiles/libremidi.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

I changed the line:

  util::write_uint16_be(out, (uint16_t)ticksPerQuarterNote);

And then it gets as far as saying it doesn't know what a QObject is:

In file included from /home/pre/src/obs-midi/obs-midi-mg/src/actions/../mmg-utils.h:20,
                 from /home/pre/src/obs-midi/obs-midi-mg/src/actions/../mmg-message.h:22,
                 from /home/pre/src/obs-midi/obs-midi-mg/src/actions/mmg-action.h:22,
                 from /home/pre/src/obs-midi/obs-midi-mg/src/actions/mmg-action.cpp:19:
/home/pre/src/obs-midi/obs-midi-mg/src/actions/../obs-midi-mg.h:22:10: fatal error: QObject: No such file or directory
   22 | #include <QObject>
      |          ^~~~~~~~~

Probably I need some more libraries or something but I have no idea what I'm doing in C or with make and cmake really.