Added GLFW error-callback into FlutterEmbedderGLFW (flutter/engine#19998)

GLFW Error callback useful to clarify reasons of 'glfwInit()' failure.

On some platforms/desktop environments may be really strange failure reasons, like (in my case): "Linux: Failed to initialize inotify: Too many open files", so descriptive error messages helps to solve problem.
This commit is contained in:
Yurii Nakonechnyi 2020-09-25 00:39:20 +03:00 committed by GitHub
parent 0937aaa3c6
commit 44252b3f41

View File

@ -129,6 +129,10 @@ void printUsage() {
<< std::endl;
}
void GLFW_ErrorCallback(int error, const char* description) {
std::cout << "GLFW Error: (" << error << ") " << description << std::endl;
}
int main(int argc, const char* argv[]) {
if (argc != 3) {
printUsage();
@ -138,6 +142,8 @@ int main(int argc, const char* argv[]) {
std::string project_path = argv[1];
std::string icudtl_path = argv[2];
glfwSetErrorCallback(GLFW_ErrorCallback);
int result = glfwInit();
assert(result == GLFW_TRUE);