Bug#642397: xfce4-power-manager: Segfault when docking

September 22nd, 2011 - 04:00 am ET by Jö Fahlke | Report spam

Package: xfce4-power-manager
Version: 0.8.5-2
Severity: normal

When I suspend my laptop to ram in undocked state, dock it, and and wake it up
again, xfce4-power-manager segfaults. The laptop is a Dell Latitude E4300, in
case that makes a difference. I don't know yet whether the same happens when
I dock the laptop while it is running. I'm going to try to obtain a backtrace
unless you have any better ideas.

Maybe I should also mention that I'm using xfce4-power-manager without xfce4
itself, but with a combination of lxpanel, lxsession and stumpwm.

Bye,
Jö.

Log of the crash:
=
joe@paranoia:~$ xfce4-power-manager --no-daemon

(xfce4-power-manager:28549): xfce4-power-manager-WARNING **: Failed to get cpu governors: Method "GetCPUFreqAvailableGovernors" with signature "" on interface "org.freedesktop.Hal.Device.CPUFreq" doesn't exist


(xfce4-power-manager:28549): xfce4-power-manager-CRITICAL **: Unable to get CPU governors


(xfce4-power-manager:28549): xfce4-power-manager-WARNING **: No convenient cpu governors found on the system, cpu frequency control will be disabled
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-primary-charged

(xfce4-power-manager:28549): xfce4-power-manager-WARNING **: could not map keysym 1008ffa8 to keycode

(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-charged
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-ac-adapter
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-primary-charged
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-ac-adapter
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-primary-charged

(xfce4-power-manager:28549): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `XfpmBattery'

(xfce4-power-manager:28549): xfce4-power-manager-CRITICAL **: xfpm_tray_icon_get_tray_icon: assertion `XFPM_IS_TRAY_ICON(icon)' failed

(xfce4-power-manager:28549): xfce4-power-manager-CRITICAL **: xfpm_tray_icon_get_icon_name: assertion `XFPM_IS_TRAY_ICON(icon)' failed

(xfce4-power-manager:28549): libnotify-CRITICAL **: notify_notification_show: assertion `NOTIFY_IS_NOTIFICATION (notification)' failed
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-charged
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-ac-adapter
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-ac-adapter
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 24 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-ac-adapter
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-primary-100-charging
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-ac-adapter
(xfce4-power-manager:28549): xfce4-power-manager-DEBUG: Size Changed 200 icon=xfpm-primary-100-charging

(xfce4-power-manager:28549): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `XfpmBattery'
Speicherzugriffsfehler
joe@paranoia:~$
=

Debian Release: 6.0.2
APT prefers stable-updates
APT policy: (990, 'stable-updates'), (990, 'stable'), (1, 'stable-updates'), (1, 'proposed-updates'), (1, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.39-bpo.2-686-pae (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages xfce4-power-manager depends on:
ii hal 0.5.14-3 Hardware Abstraction Layer
ii libc6 2.11.2-10 Embedded GNU C Library: Shared lib
ii libdbus-1-3 1.2.24-4+squeeze1 simple interprocess messaging syst
ii libdbus-glib-1-2 0.88-2.1 simple interprocess messaging syst
ii libglib2.0-0 2.24.2-1 The GLib library of C routines
ii libgtk2.0-0 2.20.1-2 The GTK+ graphical user interface
ii libnotify1 [libnotify1 0.5.0-2 sends desktop notifications to a n
ii libpango1.0-0 1.28.3-1+squeeze2 Layout and rendering of internatio
ii libx11-6 2:1.3.3-4 X11 client-side library
ii libxext6 2:1.1.2-1 X11 miscellaneous extension librar
ii libxfce4util4 4.6.2-1 Utility functions library for Xfce
ii libxfcegui4-4 4.6.4-1 Basic GUI C functions for Xfce4
ii libxfconf-0-2 4.6.2-1 Client library for Xfce4 configure
ii xfce4-power-manager-da 0.8.5-2 power manager for Xfce desktop, ar

Versions of packages xfce4-power-manager recommends:
ii consolekit 0.4.1-4 framework for defining and trackin

Versions of packages xfce4-power-manager suggests:
ii xfce4-power-manager-plugins 0.8.5-2 power manager plugins for Xfce pan


Jorrit (Jö) Fahlke, Interdisciplinary Center for Scientific Computing,
Heidelberg University, Im Neuenheimer Feld 368, D-69120 Heidelberg
Tel: +49 6221 54 8890 Fax: +49 6221 54 8884

Das Erststudium soll bis zum berufsqualifizierenden Abschluss
gebührenfrei bleiben, also bis zur Erlangung der Taxi-Lizenz.






To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
email Follow the discussionReplies 6 repliesReplies Make a reply

Similar topics

Replies

#6 Jö Fahlke
October 22nd, 2011 - 05:10 pm ET | Report spam



tags 642397 +patch
thanks

Hi!

The problem, as far as I figured it out, is apparently twofold:

1. At some point xfpm_battery_notify() is called with some XfpmBattery
object. If notifications are enabled, it will add a source with idle
priority which holds a pointer to this object and has
xfpm_battery_notify_idle() as its callback function.

2. After xfpm_battery_notify() returns, the XfpmBattery object is entered
into some hash table.

3. Later the source invokes xfpm_battery_notify_idle(). The XfpmBattery
object that is passed as an argument is usually valid. But sometimes it
has a reference count of 0 and priv == NULL.

What happens is that sometimes XfpmBattery object is removed from the hash and
freed between 2. and 3. Apparently my hal sends an add and an remove message
for the same battery immediately after each other.

The attached patch fixes this by calling g_object_ref() on the
XfpmBatteryObject in xfpm_battery_notify() before g_idle_add() is called to
add the source. The corresponding unref happens unconditionally in
xfpm_battery_notify_idle() -- that function returns FALSE, which means the
source holding the pointer to the XfpmBattery object is removed after it's
callback returns.

Please, somebody review this patch, I'm really quite new to glib and gobject
(Like: is the source's callback always called, or are there cases where the
source gets removed without beeing called? That would create a memory leak.)

Anyway, I'm going to run the patched xfpm for a while and will report back if
notice any further problems.

Bye,
Jö.

Jorrit (Jö) Fahlke, Interdisciplinary Center for Scientific Computing,
Heidelberg University, Im Neuenheimer Feld 368, D-69120 Heidelberg
Tel: +49 6221 54 8890 Fax: +49 6221 54 8884

In the beginning the Universe was created. This has made a lot of
people very angry and been widely regarded as a bad move.


diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c
index a2315ec..73bf3d1 100644
a/src/xfpm-battery.c
+++ b/src/xfpm-battery.c
@@ -242,18 +242,19 @@ xfpm_battery_notify_idle (gpointer data)
battery = XFPM_BATTERY (data);

message = xfpm_battery_get_message_from_battery_state (battery->priv->state, battery->priv->adapter_present);
- if ( !message )
- return FALSE;
-
- xfpm_notify_show_notification (battery->priv->notify,
- _("Xfce power manager"),
- message,
- xfpm_tray_icon_get_icon_name (battery->priv->icon),
- 8000,
- battery->priv->type == HAL_DEVICE_TYPE_PRIMARY ? FALSE : TRUE,
- XFPM_NOTIFY_NORMAL,
- xfpm_tray_icon_get_tray_icon(battery->priv->icon));
-
+ if ( message )
+ xfpm_notify_show_notification (battery->priv->notify,
+ _("Xfce power manager"),
+ message,
+ xfpm_tray_icon_get_icon_name (battery->priv->icon),
+ 8000,
+ battery->priv->type == HAL_DEVICE_TYPE_PRIMARY ? FALSE : TRUE,
+ XFPM_NOTIFY_NORMAL,
+ xfpm_tray_icon_get_tray_icon(battery->priv->icon));
+
+ /* returning FALSE removes the source from the main loop, so unref the
+ user data first */
+ g_object_unref (battery);
return FALSE;
}

@@ -275,6 +276,7 @@ xfpm_battery_notify (XfpmBattery *battery)

if ( notify )
{
+ g_object_ref (battery);
g_idle_add ((GSourceFunc) xfpm_battery_notify_idle, battery);
}
}







To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact
email Follow the discussion Replies Reply to this message
Help Create a new topic Previous pageReplies Make a reply
Search Make your own search