Development version / 3.0alpha crashes after splashscreen (potentially an issue portaudio)
Hi,
I'm currently trying to build run and test the latest musescore version on Win10 (build 17134.285) using a freshly installed VisualStudio environment and a .
The project appears to build fine, but it crashes during/after the splashscreen.
This happens with the nightly builds as well as with my own build.
With my own build it appears that there is an issue with portmidi (which is strange as it appears to be the same codebase that is used for musescore 2.3 which runs fine).
When running in debug mode from VisualStudio I get an Access violation exception during initialization of portaudis portmidi. at the "midiInOpen" call.
More specifically there appears to be an issues with the winmm_in_callback pointer passed to the winmm system library.
(winmmbase.dll!DriverCallback() appears to try calling to 0x0000000017d86b20, while the value of winmm_in_callback that is passed into midiInOpen is 0x00007ff617d86b20)
Could it be that there is some typecasting issue that truncates the correct callback address? But then again since the portmidi codebase is the same as in version 2.3 that appears unlikely to me.
Or could it be some issue with my build environment? If so has someone encountered similar problems and could point me towards what could be the issue here?
But then again the nightly builds appear to crash at the same point, which speaks against it being an issue with the build environment.
During linking I get a link warning "LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library", I'm not sure if that is pointing to a potential cause for the problem though.
Comments
That linker warning is the only MSVC warning my PR https://github.com/musescore/MuseScore/pull/3958 does not fix...
I don't see that crashing issue on my builds, on Windows 7
BTW: it seems you've been kicked from IRC by some spam detection, you can join again now. Assuming L0gi was you...
And this issue here probably is a duplicate of #276246: MuseScore crashes when displaying splash screen due to OpenGL 2.0 support missing
Or is it the same as https://musescore.org/en/node/276287?
thanks for unbanning.
If looked around a bit and it really appears to be some kind of 64bit/32bit addressing issue.
Removing the cast to DWORD from winmm_in_callback in midiInOpen allows the callback to properly jump into the callback routine.
But then the cast to DWORD has to also be removed from the "midi" pointer and the type for the dwInstance argument in the winmm_in_callback has to be changed to something like unsigned long long.
All in all this should be a patch in the portmidi project, if it's not just some strange quirk of my system that leads to this error.
Is our copy of portmidi on par with the current version of the portmidi project? Maybe it is fixed there since long?
I do remember quite a few MSVC compiler warnings in thirdparty/portmidi, we switched them off (
COMPILE_FLAGS "/wd4028 /wd4189 /wd4267 /wd4311 /wd4312"
), as we don't want to do anything about those warnings anyway, fixing a real bug though definitely is a different issueBTW: seems we can scratch
/wd4189
from the list of warnings to disable.In reply to Is our copy of portmidi on… by Jojo-Schmitz
There appears to have been a patch submitted for portmidi in 2014 concerning this exact problem (https://www.mail-archive.com/media_api@create.ucsb.edu/msg00513.html) But it seems that it was never incorporated in the files on sourceforge.
So let's apply that patch to our copy, as that project seems pretty dead, no changes since more than 8 years
Changed the signatures for the portmidi callbacks so they should compile correctly for win x64 and x86 with msvc.
https://github.com/musescore/MuseScore/pull/3999
See https://github.com/musescore/MuseScore/pull/3999
At https://sourceforge.net/projects/portmedia/files/portmidi/ the last version is r217 (8Oct10),
But really they are at version r234 meanwhile, just a few weeks old (23Jul18) and in r228 already (8Jan2014), this issue was fixed.
Maybe we'd better sync up with their latest source at https://sourceforge.net/p/portmedia/code/234/tree/portmidi/trunk/pm_win/ but at least with https://sourceforge.net/p/portmedia/code/228/tree/portmidi/trunk/pm_win/
See also https://github.com/musescore/MuseScore/pull/4028
Also my PR seems to fix concurreny issues with other programs using audio, which without it go silent as soon as MuseScore starts
fixed in 0ce2438
Fixed in branch master, commit a61ba575bc
Fix #276627: fixed signatures for winmm midi callback functions
by updating to the latest code, r234, of PortMedia from sourceforge
Fixed in branch master, commit 0ce2438275
Merge pull request #4028 from Jojo-Schmitz/portmidi
Fix #276627: fixed signatures for winmm midi callback functions
Automatically closed -- issue fixed for 2 weeks with no activity.