Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c6d6b04

Browse files
authored
Added GLFW error-callback into FlutterEmbedderGLFW (#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.
1 parent 876d634 commit c6d6b04

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

examples/glfw/FlutterEmbedderGLFW.cc

+6
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ void printUsage() {
129129
<< std::endl;
130130
}
131131

132+
void GLFW_ErrorCallback(int error, const char* description) {
133+
std::cout << "GLFW Error: (" << error << ") " << description << std::endl;
134+
}
135+
132136
int main(int argc, const char* argv[]) {
133137
if (argc != 3) {
134138
printUsage();
@@ -138,6 +142,8 @@ int main(int argc, const char* argv[]) {
138142
std::string project_path = argv[1];
139143
std::string icudtl_path = argv[2];
140144

145+
glfwSetErrorCallback(GLFW_ErrorCallback);
146+
141147
int result = glfwInit();
142148
assert(result == GLFW_TRUE);
143149

0 commit comments

Comments
 (0)