[Pkg-bluetooth-maintainers] Bug#531892: gnome-bluetooth: Gtk-CRITICAL when sending an empty file.
Morita Sho
morita-pub-en-debian at inz.sakura.ne.jp
Thu Jun 4 19:08:49 UTC 2009
Package: gnome-bluetooth
Version: 2.27.5-1
Severity: normal
Tags: patch
Hi,
When sending an empty file using bluetooth-sendto, I get the following Gtk-CRITICAL messages:
% touch empty.txt
% bluetooth-sendto empty.txt
(bluetooth-sendto:5848): Gtk-CRITICAL **: gtk_progress_set_percentage: assertion `percentage >= 0 && percentage <= 1.0' failed
(bluetooth-sendto:5848): Gtk-CRITICAL **: gtk_progress_set_percentage: assertion `percentage >= 0 && percentage <= 1.0' failed
After some investigation, I suspect that the following code has a possible "divide by zero" problem.
gnome-bluetooth-2.27.5/sendto/main.c:
static void transfer_progress(DBusGProxy *proxy,
guint64 bytes, gpointer user_data)
{
....
current_sent = total_sent + bytes;
fraction = (gdouble) current_sent / (gdouble) total_size; <<==
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction);
Note that total_size will be 0 if the file size is 0.
I suggest the following patch to fix the problem.
--- gnome-bluetooth-2.27.5.orig/sendto/main.c 2009-04-17 21:39:23.000000000 +0900
+++ gnome-bluetooth-2.27.5/sendto/main.c 2009-06-05 03:57:17.000000000 +0900
@@ -299,7 +299,10 @@
gchar *time, *rate, *file, *text;
current_sent = total_sent + bytes;
- fraction = (gdouble) current_sent / (gdouble) total_size;
+ if (total_size == 0)
+ fraction = 1.0;
+ else
+ fraction = (gdouble) current_sent / (gdouble) total_size;
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction);
current_time = get_system_time();
Regards,
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.29-2-686 (SMP w/1 CPU core)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages gnome-bluetooth depends on:
ii gconf2 2.26.2-1 GNOME configuration database syste
ii libatk1.0-0 1.26.0-1 The ATK accessibility toolkit
ii libc6 2.9-13 GNU C Library: Shared libraries
ii libcairo2 1.8.6-2+b1 The Cairo 2D vector graphics libra
ii libdbus-1-3 1.2.14-2 simple interprocess messaging syst
ii libdbus-glib 0.80-4 simple interprocess messaging syst
ii libfontconfi 2.6.0-3 generic font configuration library
ii libfreetype6 2.3.9-5 FreeType 2 font engine, shared lib
ii libgconf2-4 2.26.2-1 GNOME configuration database syste
ii libglib2.0-0 2.20.3-1 The GLib library of C routines
ii libgnome-blu 2.27.5-1 GNOME Bluetooth tools - support li
ii libgtk2.0-0 2.16.1-2 The GTK+ graphical user interface
ii libhal1 0.5.12~git20090406.46dc48-2 Hardware Abstraction Layer - share
ii libnotify1 [ 0.4.5-1 sends desktop notifications to a n
ii libpango1.0- 1.24.2-1 Layout and rendering of internatio
ii libunique-1. 1.0.8-1 Library for writing single instanc
ii obex-data-se 0.4.4-2 D-Bus service for OBEX client and
ii zlib1g 1:1.2.3.3.dfsg-13 compression library - runtime
Versions of packages gnome-bluetooth recommends:
ii gvfs-backends 1.2.3-1 userspace virtual filesystem - bac
Versions of packages gnome-bluetooth suggests:
pn nautilus-sendto <none> (no description available)
-- no debconf information
More information about the Pkg-bluetooth-maintainers
mailing list