gdk_x_error
- From: Alwin Leerling <leerling xtra co nz>
- To: gtk-list gnome org
- Subject: gdk_x_error
- Date: Tue, 22 Apr 2008 12:07:46 +1200
Hi,
Got a bit of a problem and I wondered if there was anyone out there who
could give me some pointers.
My application runs on an embedded device with a computer on module in
it. On it I run Linux (kernel 2.6.20), xserver ( Xorg version 7.1.1) and
gtk (gtk/gdk version 2.10.9). The device is a controller for fertilizer
spreader trucks. My application is split into two processes; one does
all the actual work and the other is a pure GUI. The working process
sends commands through a pipe to the gui process to display information.
The various devices (conveyors and spinners) are physically controlled
by separate electronics at the back of the truck. It communicates with
the controller (the working process) using a bluetooth link.
I designed the GUI to be one big window. In it I have used tab widgets
extensively to create the illusion of numerous screens. One of these
screens is visible when the truck driver is in actual spreading
operations. The back electronics continually feed device status
information which the working process sends to the GUI.
My problem is that after a certain period my program aborts. The
gdk_x_error function is called (I assume from the X server).
The error_code is 1 (BadRequest) Major code = 0 and Minor code = 0. I
understand why the X server is complaining; requests are numbered
starting at 1 so 0 is invalid.
The serial data member is not constant but is generally in the 17100000
and 17200000 range.
Running multiple tests I noticed that the error gets generated at a
certain run time plus or minus one minute.
Tracing down in my code I found the problem lines:
for( frame = 0; frame < 6; frame++ ) {
if( (device_idx = frame_device[frame]) !=
INVALID_DEVICE_IDX ) {
device_data = &spread_data->devices[device_idx];
if( !device_data->disabled ) {
gtk_label_set_ushort(
widgets->lblSpreadTarget[frame], device_data->target_rate ); //
crashed after 7 hours
gtk_label_set_ushort(
widgets->lblSpreadActual[frame], device_data->actual_rate ); //
crashed after 7 hours
gtk_progress_bar_set_fraction(
widgets->proSpreadCurrent[frame], ( ( double ) device_data->current /
100.0 ) ); // crashed after 3 hours and 47 minutes
}
}
}
gtk_label_set_ulong( widgets->lblSpreadSpeed, ( unsigned
long ) spread_data->speed ); // crashed after 7 hours
/* display range is from 0 to 4000 */
gtk_progress_bar_set_fraction( widgets->proSpreadPressure,
clamp( ( spread_data->pressure / 4000.0 ), 0, 1 ) ); // crashed after 3
hours and 47 minutes
sprintf( strTemp, "%d psi", ( int ) spread_data->pressure );
gtk_progress_bar_set_text( widgets->proSpreadPressure,
strTemp ); // does not crash for 5 hours
/* display range is from 20 C to 120 C thus the fraction is
(temp - 20)/100 clamped at 0 and 1 */
gtk_progress_bar_set_fraction(
widgets->proSpreadTemperature, clamp( ( spread_data->temperature - 20.0
) / 100.0, 0, 1 ) ); // crashed after 3 hours and 47 minutes
sprintf( strTemp, "%d °C", ( int ) spread_data->temperature );
gtk_progress_bar_set_text( widgets->proSpreadTemperature,
strTemp ); // does not crash for 5 hours
gtk_incline_set_roll_and_pitch( widgets->drawIncline,
spread_data->roll, spread_data->pitch );
}
(spread_data is a shared data structure between the working program and
the GUI, all variables are doubles).
This code gets called roughly once per second. When this code is
commented out the GUI does not crash (at least not for 48 hours). I have
commented various lines out and ran tests with the remaining lines and
noted the results after the corresponding line.
The gdk library suggest to run the program synchronous so I added the
--sync option to my startup. I build a gdk library version adding a
warning message to the gdk_display_open function to verify that I ran
synchronous. I than put the program under debug, breaking in the
gdk_x_error function. Unfortunately when the code broke, I had no stack
trace.
I'm getting slightly desperate and would appreciate any suggestions.
Best Regards
Alwin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]