cginternals / globjects

C++ library strictly wrapping OpenGL objects.
https://globjects.org
MIT License
539 stars 58 forks source link

Segfault on globjects::Registry::objects() #372

Closed nicoberrogorry closed 6 years ago

nicoberrogorry commented 6 years ago

Release build from master, Windows 10 x64 Mingw64 Clang 6 installed from MSYS2.

globjects::Registry::objects() 0x0000000068fa96c0
globjects::ObjectRegistry::current() 0x0000000068fa8341
globjects::Object::Object(std::unique_ptr<globjects::IDResource, std::default_delete<globjects::IDResource> >&&) 0x0000000068fa1a8e
globjects::Shader::Shader(gl::GLenum) 0x0000000068fab7d5
globjects::Shader::Shader(gl::GLenum, globjects::AbstractStringSource*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) 0x0000000068fab915
globjects::Instantiator<globjects::Shader>::create<gl::GLenum const&, globjects::StaticStringSource*> Instantiator.inl:16
mgl_mesh_test_inspection_Test::TestBody()::$_0::operator()() const mlg_mesh.cpp:44
std::_Function_handler<void (), mgl_mesh_test_inspection_Test::TestBody()::$_0>::_M_invoke(std::_Any_data const&) std_function.h:297
std::function<void ()>::operator()() const std_function.h:687
tea::opengl_test::RunTest(std::function<void ()>, std::function<void (double)>, std::function<void ()>) opengl_test.cpp:25
tea::free_camera_test::RunTest(std::function<void ()>, std::function<void (double, glm::mat<4, 4, double, (glm::qualifier)0>)>, std::function<void ()>) free_camera_test.cpp:103
mgl_mesh_test_inspection_Test::TestBody mlg_mesh.cpp:43
void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) 0x000000006d6f1847
testing::Test::Run() 0x000000006d6ce4bc
testing::TestInfo::Run() 0x000000006d6cf96d
testing::TestCase::Run() 0x000000006d6d01f7
testing::internal::UnitTestImpl::RunAllTests() 0x000000006d6de557
bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) 0x000000006d6f2487
testing::UnitTest::Run() 0x000000006d6de0d2
main 0x0000000062bc1405
__tmainCRTStartup 0x00000000004013a5
mainCRTStartup 0x000000000040150b
nicoberrogorry commented 6 years ago

I closed and re-opened since I found It was indeed my own mistake. I was not initializing globjects properly with globjects::init(...glfwGetProcAddress...) Now I've got another segfault on Object::id(), which probably is my own mistake again. Sorry for the pollution, maybe I'll save some other newcomers the headache once I'm done!

globjects::Object::id() const 0x0000000068fa1b40 globjects::Program::attach(globjects::Shader*) 0x0000000068fa32a1 globjects::Program::attach<globjects::Shader*> Program.inl:115 mgl_mesh_test_inspection_Test::TestBody()::$_0::operator()() const mlg_mesh.cpp:52 std::_Function_handler<void (), mgl_mesh_test_inspection_Test::TestBody()::$_0>::_M_invoke(std::_Any_data const&) std_function.h:297 std::function<void ()>::operator()() const std_function.h:687 tea::opengl_test::RunTest(std::function<void ()>, std::function<void (double)>, std::function<void ()>) opengl_test.cpp:25 tea::free_camera_test::RunTest(std::function<void ()>, std::function<void (double, glm::mat<4, 4, double, (glm::qualifier)0>)>, std::function<void ()>) free_camera_test.cpp:103 mgl_mesh_test_inspection_Test::TestBody mlg_mesh.cpp:45 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) 0x000000006d6f1847 testing::Test::Run() 0x000000006d6ce4bc testing::TestInfo::Run() 0x000000006d6cf96d testing::TestCase::Run() 0x000000006d6d01f7 testing::internal::UnitTestImpl::RunAllTests() 0x000000006d6de557 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) 0x000000006d6f2487 testing::UnitTest::Run() 0x000000006d6de0d2 main 0x0000000062bc1405 __tmainCRTStartup 0x00000000004013a5 mainCRTStartup 0x000000000040150b

nicoberrogorry commented 6 years ago

Ok it's working, maybe it's worth keeping this issue as some noobs like myself might get confused on how to use this library. Conclusion:

scheibel commented 6 years ago

Thanks for using globjects. Although you found and presumably fixed the issue yourself, I think we can learn from this issue nonetheless: