[cheese/three-point-oh] Crash when adding resolutions for second time fixed.
- From: Yuvaraj Pandian <yuvipanda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/three-point-oh] Crash when adding resolutions for second time fixed.
- Date: Thu, 15 Jul 2010 13:56:51 +0000 (UTC)
commit cbd67b32c59e28f8516fef478c328bf0bc2eeed2
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Thu Jul 15 19:25:58 2010 +0530
Crash when adding resolutions for second time fixed.
I have a vague feeling I'm leaking memory somewhere there. Needs investigation
src/cheese-preferences.vala | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index 90a6e30..1057f90 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -47,15 +47,11 @@ internal class Cheese.PreferencesDialog : GLib.Object
private void setup_combo_box_models ()
{
- ListStore camera_model = new ListStore (2, typeof (string), typeof (Cheese.CameraDevice));
- ListStore resolution_model = new ListStore (2, typeof (string), typeof (Cheese.VideoFormat));
- CellRendererText cell = new CellRendererText ();
+ CellRendererText cell = new CellRendererText ();
- resolution_combo.model = resolution_model;
resolution_combo.pack_start (cell, false);
resolution_combo.set_attributes (cell, "text", 0);
- source_combo.model = camera_model;
source_combo.pack_start (cell, false);
source_combo.set_attributes (cell, "text", 0);
}
@@ -64,19 +60,19 @@ internal class Cheese.PreferencesDialog : GLib.Object
{
Cheese.CameraDevice dev;
TreeIter active_dev;
- unowned GLib.PtrArray devices = camera.get_camera_devices ();
- ListStore model;
+ unowned GLib.PtrArray devices = camera.get_camera_devices ();
+ ListStore camera_model = new ListStore (2, typeof (string), typeof (Cheese.CameraDevice));
- model = (ListStore) source_combo.model;
+ source_combo.model = camera_model;
for (int i = 0; i < devices.len; i++)
{
TreeIter iter;
dev = (Cheese.CameraDevice)devices.index (i);
- model.append (out iter);
- model.set (iter,
- 0, dev.get_name () + " (" + dev.get_device_file () + " )",
- 1, dev);
+ camera_model.append (out iter);
+ camera_model.set (iter,
+ 0, dev.get_name () + " (" + dev.get_device_file () + " )",
+ 1, dev);
if (camera.get_selected_device ().get_device_file () == dev.get_device_file ())
{
source_combo.set_active_iter (iter);
@@ -92,20 +88,19 @@ internal class Cheese.PreferencesDialog : GLib.Object
private void setup_resolutions_for_device (Cheese.CameraDevice device)
{
unowned List<VideoFormat> formats = device.get_format_list ();
- ListStore model;
unowned Cheese.VideoFormat format;
+ ListStore resolution_model = new ListStore (2, typeof (string), typeof (Cheese.VideoFormat));
- model = (ListStore) resolution_combo.model;
- model.clear ();
+ resolution_combo.model = resolution_model;
for (int i = 0; i < formats.length (); i++)
{
TreeIter iter;
format = formats<VideoFormat>.nth (i).data;
- model.append (out iter);
- model.set (iter,
- 0, format.width.to_string () + " x " + format.height.to_string (),
- 1, format);
+ resolution_model.append (out iter);
+ resolution_model.set (iter,
+ 0, format.width.to_string () + " x " + format.height.to_string (),
+ 1, format);
if (camera.get_current_video_format ().width == format.width &&
camera.get_current_video_format ().height == format.height)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]