mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 21:14:35 +00:00
Added DBus pointer checks
This commit is contained in:
parent
ef4d722b76
commit
589e6b78d9
@ -41,8 +41,9 @@ void _glfwInitDBusPOSIX(void)
|
|||||||
_glfw.dbus.connection = NULL;
|
_glfw.dbus.connection = NULL;
|
||||||
|
|
||||||
_glfw.dbus.handle = _glfwPlatformLoadModule("libdbus-1.so.3");
|
_glfw.dbus.handle = _glfwPlatformLoadModule("libdbus-1.so.3");
|
||||||
if (_glfw.dbus.handle)
|
if (!_glfw.dbus.handle)
|
||||||
{
|
return;
|
||||||
|
|
||||||
_glfw.dbus.error_init = (PFN_dbus_error_init)
|
_glfw.dbus.error_init = (PFN_dbus_error_init)
|
||||||
_glfwPlatformGetModuleSymbol(_glfw.dbus.handle, "dbus_error_init");
|
_glfwPlatformGetModuleSymbol(_glfw.dbus.handle, "dbus_error_init");
|
||||||
_glfw.dbus.error_is_set = (PFN_dbus_error_is_set)
|
_glfw.dbus.error_is_set = (PFN_dbus_error_is_set)
|
||||||
@ -72,6 +73,26 @@ void _glfwInitDBusPOSIX(void)
|
|||||||
_glfw.dbus.message_iter_close_container = (PFN_dbus_message_iter_close_container)
|
_glfw.dbus.message_iter_close_container = (PFN_dbus_message_iter_close_container)
|
||||||
_glfwPlatformGetModuleSymbol(_glfw.dbus.handle, "dbus_message_iter_close_container");
|
_glfwPlatformGetModuleSymbol(_glfw.dbus.handle, "dbus_message_iter_close_container");
|
||||||
|
|
||||||
|
if (!_glfw.dbus.error_init ||
|
||||||
|
!_glfw.dbus.error_is_set ||
|
||||||
|
!_glfw.dbus.error_free ||
|
||||||
|
!_glfw.dbus.connection_unref ||
|
||||||
|
!_glfw.dbus.connection_send ||
|
||||||
|
!_glfw.dbus.connection_flush ||
|
||||||
|
!_glfw.dbus.bus_request_name ||
|
||||||
|
!_glfw.dbus.bus_get ||
|
||||||
|
!_glfw.dbus.message_unref ||
|
||||||
|
!_glfw.dbus.message_new_signal ||
|
||||||
|
!_glfw.dbus.message_iter_init_append ||
|
||||||
|
!_glfw.dbus.message_iter_append_basic ||
|
||||||
|
!_glfw.dbus.message_iter_open_container ||
|
||||||
|
!_glfw.dbus.message_iter_close_container)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"POSIX: Failed to load DBus entry points");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Initialize DBus connection
|
//Initialize DBus connection
|
||||||
dbus_error_init(&_glfw.dbus.error);
|
dbus_error_init(&_glfw.dbus.error);
|
||||||
_glfw.dbus.connection = dbus_bus_get(DBUS_BUS_SESSION, &_glfw.dbus.error);
|
_glfw.dbus.connection = dbus_bus_get(DBUS_BUS_SESSION, &_glfw.dbus.error);
|
||||||
@ -104,14 +125,6 @@ void _glfwInitDBusPOSIX(void)
|
|||||||
_glfw.dbus.connection = NULL;
|
_glfw.dbus.connection = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(_glfw.dbus.connection)
|
|
||||||
{
|
|
||||||
//Window NULL is safe here because it won't get
|
|
||||||
//used inside the SetWindowTaskbarProgress function
|
|
||||||
_glfw.platform.setWindowProgressIndicator(NULL, GLFW_PROGRESS_INDICATOR_DISABLED, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwTerminateDBusPOSIX(void)
|
void _glfwTerminateDBusPOSIX(void)
|
||||||
|
@ -1843,6 +1843,14 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window,
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Reset progress state as it gets saved between application runs
|
||||||
|
if(_glfw.dbus.connection)
|
||||||
|
{
|
||||||
|
//Window NULL is safe here because it won't get
|
||||||
|
//used inside the SetWindowTaskbarProgress function
|
||||||
|
_glfwSetWindowProgressIndicatorWayland(NULL, GLFW_PROGRESS_INDICATOR_DISABLED, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2040,6 +2040,14 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Reset progress state as it gets saved between application runs
|
||||||
|
if(_glfw.dbus.connection)
|
||||||
|
{
|
||||||
|
//Window NULL is safe here because it won't get
|
||||||
|
//used inside the SetWindowTaskbarProgress function
|
||||||
|
_glfwSetWindowProgressIndicatorX11(NULL, GLFW_PROGRESS_INDICATOR_DISABLED, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
XFlush(_glfw.x11.display);
|
XFlush(_glfw.x11.display);
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user