projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.33k stars 373 forks source link

[BUG] Crash on projectm_create() on Windows #822

Open jonaski opened 3 months ago

jonaski commented 3 months ago

Please confirm the following points:

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()

kblaschke commented 3 months ago

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.

kblaschke commented 3 months ago

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.