diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-11-24 15:32:16 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-11-24 17:07:28 +0000 |
commit | 1bd5e8b73d863cad6e42ea9619fc471a0dd8d14b (patch) | |
tree | ecd919372d3611261a7a8983817ea0096009a1f5 | |
parent | a81de86c47322bd6bc59b462eb2f69e0f1185df4 (diff) |
vcl: reduce maximum timeout to some sensible range.
This fixes a bug with glib, where prepare of a source with such a
large (max uint64) causes precision & wrap-around problems.
Add assert to avoid recurrence.
Also add a helpful user-visible source name in debug mode.
Change-Id: I9e1eb41af9cc49f8bff88e07f04d4bc4d1877376
Reviewed-on: https://gerrit.libreoffice.org/20152
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | include/vcl/scheduler.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/gtkdata.cxx | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index 9cd7fb845d4f..be9df9e69e5a 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -61,7 +61,7 @@ protected: // These should be constexpr static, when supported. static const sal_uInt64 ImmediateTimeoutMs = 1; - static const sal_uInt64 MaximumTimeoutMs = SAL_MAX_UINT64; + static const sal_uInt64 MaximumTimeoutMs = 1000 * 60; // 1 minute static void ImplStartTimer(sal_uInt64 nMS, bool bForce = false); diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx index d25b03652a6d..f65b4e0a7567 100644 --- a/vcl/unx/gtk/gtkdata.cxx +++ b/vcl/unx/gtk/gtkdata.cxx @@ -905,6 +905,9 @@ create_sal_gtk_timeout( GtkSalTimer *pTimer ) /* unused dummy */ g_idle_remove_by_data, nullptr, nullptr ); g_source_attach( pSource, g_main_context_default() ); +#ifdef DBG_UTIL + g_source_set_name( pSource, "VCL timeout source" ); +#endif sal_gtk_timeout_defer( pTSource ); @@ -937,6 +940,8 @@ bool GtkSalTimer::Expired() void GtkSalTimer::Start( sal_uLong nMS ) { + // glib is not 64bit safe in this regard. + assert( nMS <= G_MAXINT ); m_nTimeoutMS = nMS; // for restarting Stop(); // FIXME: ideally re-use an existing m_pTimeout m_pTimeout = create_sal_gtk_timeout( this ); |