comparison src/color-man.c @ 1523:24a12aa0cb54

Fix up event source ids type: gint -> guint. Functions like g_timeout_add() or g_idle_add() return a guint greater than 0, but in most places it was wrongly stored as int and initialized to -1. This broke assertions matching in g_source_remove() for example since id was always greater than 0 even when timer was not set (-1 was casted to the biggest guint).
author zas_
date Mon, 06 Apr 2009 22:13:54 +0000
parents 3a9fb1b52559
children b5608391f479
comparison
equal deleted inserted replaced
1522:d7206703d90f 1523:24a12aa0cb54
324 if (!cm->pixbuf) return FALSE; 324 if (!cm->pixbuf) return FALSE;
325 325
326 if (cm->imd && 326 if (cm->imd &&
327 cm->pixbuf != image_get_pixbuf(cm->imd)) 327 cm->pixbuf != image_get_pixbuf(cm->imd))
328 { 328 {
329 cm->idle_id = -1; 329 cm->idle_id = 0;
330 color_man_done(cm, COLOR_RETURN_IMAGE_CHANGED); 330 color_man_done(cm, COLOR_RETURN_IMAGE_CHANGED);
331 return FALSE; 331 return FALSE;
332 } 332 }
333 333
334 width = gdk_pixbuf_get_width(cm->pixbuf); 334 width = gdk_pixbuf_get_width(cm->pixbuf);
339 if (!cm->incremental_sync && cm->imd) 339 if (!cm->incremental_sync && cm->imd)
340 { 340 {
341 image_area_changed(cm->imd, 0, 0, width, height); 341 image_area_changed(cm->imd, 0, 0, width, height);
342 } 342 }
343 343
344 cm->idle_id = -1; 344 cm->idle_id = 0;
345 color_man_done(cm, COLOR_RETURN_SUCCESS); 345 color_man_done(cm, COLOR_RETURN_SUCCESS);
346 return FALSE; 346 return FALSE;
347 } 347 }
348 348
349 rh = COLOR_MAN_CHUNK_SIZE / width + 1; 349 rh = COLOR_MAN_CHUNK_SIZE / width + 1;
367 cm = g_new0(ColorMan, 1); 367 cm = g_new0(ColorMan, 1);
368 cm->imd = imd; 368 cm->imd = imd;
369 cm->pixbuf = pixbuf; 369 cm->pixbuf = pixbuf;
370 if (cm->pixbuf) g_object_ref(cm->pixbuf); 370 if (cm->pixbuf) g_object_ref(cm->pixbuf);
371 371
372 cm->incremental_sync = FALSE;
373 cm->row = 0;
374 cm->idle_id = -1;
375
376 has_alpha = pixbuf ? gdk_pixbuf_get_has_alpha(pixbuf) : FALSE; 372 has_alpha = pixbuf ? gdk_pixbuf_get_has_alpha(pixbuf) : FALSE;
377 373
378 cm->profile = color_man_cache_get(input_type, input_file, input_data, input_data_len, 374 cm->profile = color_man_cache_get(input_type, input_file, input_data, input_data_len,
379 screen_type, screen_file, has_alpha); 375 screen_type, screen_file, has_alpha);
380 if (!cm->profile) 376 if (!cm->profile)
413 409
414 void color_man_free(ColorMan *cm) 410 void color_man_free(ColorMan *cm)
415 { 411 {
416 if (!cm) return; 412 if (!cm) return;
417 413
418 if (cm->idle_id != -1) g_source_remove(cm->idle_id); 414 if (cm->idle_id) g_source_remove(cm->idle_id);
419 if (cm->pixbuf) g_object_unref(cm->pixbuf); 415 if (cm->pixbuf) g_object_unref(cm->pixbuf);
420 416
421 color_man_cache_unref(cm->profile); 417 color_man_cache_unref(cm->profile);
422 418
423 g_free(cm); 419 g_free(cm);