projectm
projectm copied to clipboard
[BUG] Crash on projectm_create() on Windows
Please confirm the following points:
- [X] This report is NOT about the Android apps in the Play Store
- [X] I have searched the project page to check if the issue was already reported
Affected Application
Third-Party Integration (Kodi, VLC, etc. - please specify below)
Affected Version
4.1.1
Operating System
Windows
Additional Application Details
Visual Studio 2022 on Windows 10.
Type of Defect
Crash (unexpected closing, OS crash dialog)
Log Output
0000000000000000() Unknown
> projectM-4d.dll!libprojectM::Renderer::Sampler::Sampler(int wrapMode, int filterMode) Line 11 C++
projectM-4d.dll!std::_Construct_in_place<libprojectM::Renderer::Sampler,int,int>(libprojectM::Renderer::Sampler & _Obj, int && <_Args_0>, int && <_Args_1>) Line 388 C++
projectM-4d.dll!std::_Ref_count_obj2<libprojectM::Renderer::Sampler>::_Ref_count_obj2<libprojectM::Renderer::Sampler><int,int>(int && <_Args_0>, int && <_Args_1>) Line 2083 C++
projectM-4d.dll!std::make_shared<libprojectM::Renderer::Sampler,int,int>(int && <_Args_0>, int && <_Args_1>) Line 2896 C++
projectM-4d.dll!libprojectM::Renderer::TextureManager::Preload() Line 67 C++
projectM-4d.dll!libprojectM::Renderer::TextureManager::TextureManager(const std::vector<std::string,std::allocator<std::string>> & textureSearchPaths) Line 31 C++
projectM-4d.dll!std::make_unique<libprojectM::Renderer::TextureManager,std::vector<std::string,std::allocator<std::string>> &,0>(std::vector<std::string,std::allocator<std::string>> & <_Args_0>) Line 3595 C++
projectM-4d.dll!libprojectM::ProjectM::Initialize() Line 197 C++
projectM-4d.dll!libprojectM::ProjectM::ProjectM() Line 40 C++
projectM-4d.dll!libprojectM::projectMWrapper::projectMWrapper() C++
projectM-4d.dll!projectm_create() Line 68 C++
strawberry.exe!ProjectMVisualization::Init() Line 146 C++
strawberry.exe!VisualizationOpenGLWidget::initializeGL() Line 35 C++
Qt6OpenGLWidgetsd.dll!QOpenGLWidgetPrivate::initialize() Line 902 C++
Qt6OpenGLWidgetsd.dll!QOpenGLWidget::event(QEvent * e) Line 1720 C++
Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3287 C++
Qt6Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3234 C++
Qt6Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1142 C++
Qt6Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 1584 C++
Qt6Widgetsd.dll!QWidgetPrivate::show_helper() Line 8139 C++
Qt6Widgetsd.dll!QWidgetPrivate::setVisible(bool visible) Line 8445 C++
Qt6Widgetsd.dll!QWidgetPrivate::showChildren(bool spontaneous) Line 8526 C++
Qt6Widgetsd.dll!QWidgetPrivate::show_helper() Line 8096 C++
Qt6Widgetsd.dll!QWidgetPrivate::setVisible(bool visible) Line 8445 C++
Qt6Widgetsd.dll!QWidget::setVisible(bool visible) Line 8371 C++
Qt6Widgetsd.dll!QWidget::show() Line 7992 C++
strawberry.exe!MainWindow::ShowVisualizations() Line 3361 C++
strawberry.exe!QtPrivate::FunctorCall<QtPrivate::IndexesList<>,QtPrivate::List<>,void,void (__cdecl MainWindow::*)(void)>::call(void(MainWindow::*)() f, MainWindow * o, void * * arg) Line 145 C++
strawberry.exe!QtPrivate::FunctionPointer<void (__cdecl MainWindow::*)(void)>::call<QtPrivate::List<>,void>(void(MainWindow::*)() f, MainWindow * o, void * * arg) Line 182 C++
strawberry.exe!QtPrivate::QCallableObject<void (__cdecl MainWindow::*)(void),QtPrivate::List<>,void>::impl(int which, QtPrivate::QSlotObjectBase * this_, QObject * r, void * * a, bool * ret) Line 553 C++
Qt6Cored.dll!QtPrivate::QSlotObjectBase::call(QObject * r, void * * a) Line 469 C++
Qt6Cored.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 4086 C++
Qt6Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 4146 C++
Qt6Guid.dll!QAction::triggered(bool _t1) Line 484 C++
Qt6Guid.dll!QAction::activate(QAction::ActionEvent event) Line 1102 C++
Qt6Widgetsd.dll!QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget>> & causedStack, QAction * action, QAction::ActionEvent action_e, bool self) Line 1420 C++
Qt6Widgetsd.dll!QMenuPrivate::activateAction(QAction * action, QAction::ActionEvent action_e, bool self) Line 1502 C++
Qt6Widgetsd.dll!QMenu::mouseReleaseEvent(QMouseEvent * e) Line 2934 C++
Qt6Widgetsd.dll!QWidget::event(QEvent * event) Line 9025 C++
Qt6Widgetsd.dll!QMenu::event(QEvent * e) Line 3060 C++
Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3287 C++
Qt6Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2765 C++
Qt6Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1142 C++
Qt6Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 1598 C++
Qt6Widgetsd.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous, bool onlyDispatchEnterLeave) Line 2347 C++
Qt6Widgetsd.dll!QWidgetWindow::handleMouseEvent(QMouseEvent * event) Line 546 C++
Qt6Widgetsd.dll!QWidgetWindow::event(QEvent * event) Line 264 C++
Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3287 C++
Qt6Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3238 C++
Qt6Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1142 C++
Qt6Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 1598 C++
Qt6Guid.dll!QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent * e) Line 2328 C++
Qt6Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * e) Line 2071 C++
Qt6Guid.dll!QWindowSystemInterface::sendWindowSystemEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1114 C++
Qt6Guid.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 44 C++
Qt6Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 468 C++
Qt6Guid.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 36 C++
Qt6Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 101 C++
Qt6Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 182 C++
Qt6Cored.dll!QCoreApplication::exec() Line 1486 C++
strawberry.exe!main(int argc, char * * argv) Line 322 C++
strawberry.exe!invoke_main() Line 79 C++
strawberry.exe!__scrt_common_main_seh() Line 288 C++
strawberry.exe!__scrt_common_main() Line 331 C++
strawberry.exe!mainCRTStartup(void * __formal) Line 17 C++
kernel32.dll!00007ff995b97344() Unknown
ntdll.dll!00007ff996b5cc91() Unknown
Describe the Issue
Crash occurs when calling projectm_create()
Looks like there's no active or an improperly configured (e.g. just a 1.x fixed function profile) OpenGL context.
The sampler is the first object being created during construction, and we don't check the return value of the sampler allocator (not great, but should work). The crash is happening in the following line when this object is used.
Can you provide information about the GL profile used for the context in question? Specifically, the core profile version. It should be 3.3 for projectM to work.
Additionally, it may be required to initialize GLEW before creating the projectM instance, otherwise some GL functions may not be initialized properly and point to either 0 or a random address.
I started to make an addon for Open Frameworks: https://github.com/Jonathhhan/ofxProjectM and have the same issue with Windows, while it works well with Linux. It also crashes with other functions, so it does not seem to be an openGL issue?
It works for me now, but the solution seems a little strange: I need to use the static lib libprojectM-4.lib and the dll projectM-4.dll then it does work.
Fixed it, I made something wrong compiling it. I use static libs now and it works well.
MSVC needs a static import lib to properly link DLLs at built time. This is different from the actual static library, even if both have the same .lib extension. The import library basically only has symbol and address information to tell the linker which offsets to call and how the data needs to be passed, while the static library also contains the full object code. You shouldn't mix both variants, as they often use different MSVC runtimes (MT/MD) and the DLL also has its own heap space, which, if mixed, will cause all sorts of memory issues.
That said, when building your project, always check if these things match both your code/build settings and those of projectM:
- MSVC toolset (compiler, Windows SDK)
- MSVC runtime type (static/MT or dynamic/MD)
- Debug/Release build type (also always use either release or debug runtime, e.g.
/MTdor/MTfor both) - Only link either static or shared projectM libraries, don't mix them
Using CMake and vcpkg with a specific triplet to build everything can help getting things straight. This is actually one of those things which are way worse than on Linux/macOS toolchains - all the possible combinations of the above.
Closing the issue as it seems to be solved. If you still have this issue, feel free to reopen!