[Libreoffice-commits] core.git: include/vcl vcl/unx
Michael Meeks
michael.meeks at collabora.com
Tue Nov 24 09:07:59 PST 2015
include/vcl/scheduler.hxx | 2 +-
vcl/unx/gtk/gtkdata.cxx | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 1bd5e8b73d863cad6e42ea9619fc471a0dd8d14b
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Nov 24 15:32:16 2015 +0000
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 at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index 9cd7fb8..be9df9e 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 d25b036..f65b4e0 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 );
More information about the Libreoffice-commits
mailing list