PKGBUILDs/community/xsensors/xsensors-0.60-gui-segfault.patch
2009-10-09 21:15:33 -05:00

427 lines
17 KiB
Diff

--- xsensors-0.60.orig/src/gui.c.original 2007-12-01 11:26:02.000000000 +0100
+++ xsensors-0.60/src/gui.c 2007-12-01 11:18:18.000000000 +0100
@@ -116,199 +116,200 @@
gdk_window_clear_area( widget->window, event->area.x, event->area.y,
event->area.width, event->area.height );
-
- switch ( current->feattype ) {
- case FAN:
- if ( current->curvalue < current->curmin )
- highLow = 30;
-
- result = (int) current->curvalue;
-
- x = 198;
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 0, 0, 18, 30 );
-
- curInt = result / 1000;
- result = result % 1000;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 18, 0, 18, 30 );
-
- curInt = result / 100;
- result = result % 100;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 36, 0, 18, 30 );
-
- curInt = result / 10;
- result = result % 10;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 54, 0, 18, 30 );
-
- curInt = result;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 72, 0, 18, 30 );
-
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, 0, 120 + highLow,
- 90, 0, 57, 30 );
- break;
- case TEMP:
- if ( current->curvalue > current->curmax )
- highLow = 30;
-
- if ( tf == TRUE )
- current->curvalue = ( 1.8 * current->curvalue ) + 32;
-
- result = (int) ( current->curvalue * 10 );
-
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, 198, highLow,
- 0, 0, 18, 30 );
-
- if ( result >= 1000 ) {
- curInt = result / 1000;
- result = result % 1000;
- get_pm_location( curInt, &x );
- } else {
+ if (current != NULL) {
+ switch ( current->feattype ) {
+ case FAN:
+ if ( current->curvalue < current->curmin )
+ highLow = 30;
+
+ result = (int) current->curvalue;
+
x = 198;
- }
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 18, 0, 18, 30 );
-
- curInt = result / 100;
- result = result % 100;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 36, 0, 18, 30 );
-
- curInt = result / 10;
- result = result % 10;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 54, 0, 18, 30 );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 0, 0, 18, 30 );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, 171, 60 + highLow,
- 72, 0, 18, 30 );
-
- curInt = result;
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 78, 0, 18, 30 );
-
- if ( tf == FALSE )
- x = 0;
- else
- x = 57;
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, 60 + highLow,
- 96, 0, 57, 30 );
-
- break;
- case VOLT:
- if ( current->curvalue > current->curmax ||
- current->curvalue < current->curmin )
- highLow = 30;
-
- result = round( current->curvalue * 100 );
-
- if ( result < 0 ) {
- result = result * -1;
- x = 180;
- } else {
- x = 198;
- }
-
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 0, 0, 18, 30 );
-
- if ( result >= 1000 ) {
curInt = result / 1000;
result = result % 1000;
+
get_pm_location( curInt, &x );
- } else {
- x = 198;
- }
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 18, 0, 18, 30 );
-
- curInt = result / 100;
- result = result % 100;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 36, 0, 18, 30 );
-
- /* Display decimal point */
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, 171, 60 + highLow,
- 54, 0, 6, 30 );
-
- curInt = result / 10;
- result = result % 10;
-
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 60, 0, 18, 30 );
-
-
- curInt = result;
- get_pm_location( curInt, &x );
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, x, highLow,
- 78, 0, 18, 30 );
-
- /* Display V */
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[ GTK_WIDGET_STATE
- (widget) ], theme, 114, 60 + highLow,
- 96, 0, 57, 30 );
-
-
- break;
- default:
- break;
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 18, 0, 18, 30 );
+
+ curInt = result / 100;
+ result = result % 100;
+
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 36, 0, 18, 30 );
+
+ curInt = result / 10;
+ result = result % 10;
+
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 54, 0, 18, 30 );
+
+ curInt = result;
+
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 72, 0, 18, 30 );
+
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, 0, 120 + highLow,
+ 90, 0, 57, 30 );
+ break;
+ case TEMP:
+ if ( current->curvalue > current->curmax )
+ highLow = 30;
+
+ if ( tf == TRUE )
+ current->curvalue = ( 1.8 * current->curvalue ) + 32;
+
+ result = (int) ( current->curvalue * 10 );
+
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, 198, highLow,
+ 0, 0, 18, 30 );
+
+ if ( result >= 1000 ) {
+ curInt = result / 1000;
+ result = result % 1000;
+ get_pm_location( curInt, &x );
+ } else {
+ x = 198;
+ }
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 18, 0, 18, 30 );
+
+ curInt = result / 100;
+ result = result % 100;
+
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 36, 0, 18, 30 );
+
+ curInt = result / 10;
+ result = result % 10;
+
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 54, 0, 18, 30 );
+
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, 171, 60 + highLow,
+ 72, 0, 18, 30 );
+
+ curInt = result;
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 78, 0, 18, 30 );
+
+ if ( tf == FALSE )
+ x = 0;
+ else
+ x = 57;
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, 60 + highLow,
+ 96, 0, 57, 30 );
+
+ break;
+ case VOLT:
+ if ( current->curvalue > current->curmax ||
+ current->curvalue < current->curmin )
+ highLow = 30;
+
+ result = round( current->curvalue * 100 );
+
+ if ( result < 0 ) {
+ result = result * -1;
+ x = 180;
+ } else {
+ x = 198;
+ }
+
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 0, 0, 18, 30 );
+
+ if ( result >= 1000 ) {
+ curInt = result / 1000;
+ result = result % 1000;
+ get_pm_location( curInt, &x );
+ } else {
+ x = 198;
+ }
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 18, 0, 18, 30 );
+
+ curInt = result / 100;
+ result = result % 100;
+
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 36, 0, 18, 30 );
+
+ /* Display decimal point */
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, 171, 60 + highLow,
+ 54, 0, 6, 30 );
+
+ curInt = result / 10;
+ result = result % 10;
+
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 60, 0, 18, 30 );
+
+
+ curInt = result;
+ get_pm_location( curInt, &x );
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, x, highLow,
+ 78, 0, 18, 30 );
+
+ /* Display V */
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[ GTK_WIDGET_STATE
+ (widget) ], theme, 114, 60 + highLow,
+ 96, 0, 57, 30 );
+
+
+ break;
+ default:
+ break;
+ }
}
return TRUE;
@@ -471,12 +472,14 @@
if ( head == NULL ) {
prev = head;
head = current = add_node( head, name, darea, featpbar, feature );
- } else {
+ } else if (current != NULL) {
prev = current;
current = current->next =
- add_node( current->next, name, darea, featpbar, feature );
- }
-
+ add_node(current->next, name, darea, featpbar, feature);
+ } else
+ continue;
+
+
/* Connect the expose event sinal handler to redraw the numbers. */
g_signal_connect( G_OBJECT(darea), "expose_event",
G_CALLBACK(expose_event_callback), current );
@@ -499,7 +502,7 @@
}
gtk_frame_set_label( GTK_FRAME (featframe), feattext );
-
+ if (current != NULL) {
switch ( current->feattype ) {
case VOLT:
currbox = voltbox;
@@ -518,6 +521,7 @@
"Type not recognized, not packing.\n" );
break;
}
+ }
gtk_box_pack_start( GTK_BOX (currbox), featframe,
FALSE, FALSE, 0 );
gtk_container_add (GTK_CONTAINER (featframe), innerbox);