After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 527736 - starting cheese twice produces two cheese windows
starting cheese twice produces two cheese windows
Status: RESOLVED FIXED
Product: cheese
Classification: Applications
Component: general
2.23.x
Other Linux
: Normal minor
: 2.24
Assigned To: Cheese Maintainer(s)
Cheese Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2008-04-12 16:48 UTC by daniel g. siegel
Modified: 2008-08-16 18:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
solves the issue with dbus (10.04 KB, patch)
2008-08-16 10:18 UTC, Felix Kaser
reviewed Details | Review
improved patch (10.33 KB, patch)
2008-08-16 12:05 UTC, Felix Kaser
needs-work Details | Review
new patch with urgency hint (13.33 KB, patch)
2008-08-16 16:14 UTC, Felix Kaser
needs-work Details | Review
should solve the issue with gtk_window_present (13.28 KB, patch)
2008-08-16 17:58 UTC, Felix Kaser
committed Details | Review

Description daniel g. siegel 2008-04-12 16:48:29 UTC
wrong. as most users just have one webcam, we just want to show that one once.
Comment 1 Baptiste Mille-Mathias 2008-04-19 20:06:22 UTC
Daniel, 

When you set a bug as gnome-love, please provide detailed comments on how to achieve to fix the bug like files and functions to look at.
All people is not as aware as you of the code of cheese :).

thanks a lot.
Comment 2 Bastien Nocera 2008-05-16 00:03:06 UTC
You could use "unique" to do this easily. It would also allow users to script cheese to take pictures at recurring intervals, or something.
Comment 3 Felix Kaser 2008-07-15 19:10:44 UTC
The actual version of cheese I work with (branch of the latest trunk, 2 weeks ago) doesn't open a second window. The problem is, the second window is segfaulting, probably because he can't access the webcam?

Here comes the bt of gdb of the second cheese instance:

(gdb) run -v
Starting program: /usr/local/bin/cheese -v
[Thread debugging using libthread_db enabled]
[New Thread 0xb6755740 (LWP 15706)]
[New Thread 0xb5e82b90 (LWP 15710)]
[New Thread 0xb5681b90 (LWP 15711)]
[New Thread 0xb54d5b90 (LWP 15712)]
[New Thread 0xb4cd4b90 (LWP 15713)]

Program received signal SIGSEGV, Segmentation fault.

Thread 3051891600 (LWP 15710)

  • #0 find_highest_framerate
    at cheese-webcam.c line 622
  • #1 cheese_webcam_setup
    at cheese-webcam.c line 693
  • #2 setup_camera
    at cheese-window.c line 1392
  • #3 ??
    from /usr/lib/libglib-2.0.so.0
  • #4 start_thread
    from /lib/tls/i686/cmov/libpthread.so.0
  • #5 clone
    from /lib/tls/i686/cmov/libc.so.6

Comment 4 daniel g. siegel 2008-07-15 19:20:30 UTC
exactly ;)
Comment 5 Felix Kaser 2008-07-15 21:19:15 UTC
still doesn't solve the issue I think :) this bug is closed, but shall we open another one?

I'm just kidding =) I'm not that hot to get more bugzilla points than my age is (wouldn't be possible I think...)

I will solve this bug as soon as I get some time, shouldn't be that hard and would be nice in 2.24

Can the bug be assigned to me? How? Can I get points for it? :D
Comment 6 Felix Kaser 2008-08-13 17:52:11 UTC
the attachment in bug #522199 should solve this issue!

http://bugzilla.gnome.org/attachment.cgi?id=116512&action=view
Comment 7 Felix Kaser 2008-08-16 10:18:04 UTC
Created attachment 116730 [details] [review]
solves the issue with dbus

this solves the issue, its part of my integration work which provides a more powerfull dbus class! This is only a small part to solve the issue, the full dbus class will be in 2.26...
Comment 8 Filippo Argiolas 2008-08-16 11:14:58 UTC
Seems ok to me, +1 to commit!

I just have a couple of notes/suggestions:

1. What about setting urgent hint when a second instance is started? or just bring cheese window on top?

2. Why do you start cheese_dbus server there? there are a couple of initializations before that are not being freed if cheese quits (fileutile_new, gconf_new). 
What about moving it to cheese.c before goption parsing and pass the server to cheese_window adding an argument to cheese_window_init?

3. struct _CheeseDbus *server; shouldn't be just CheeseDbus *server; ?
Comment 9 Felix Kaser 2008-08-16 12:02:21 UTC
Thanks for the review!

point 1: Sounds good, but how? Any suggestions? I would need the window to do that and thats a problem because the window gets initialized after this part (look at point 2 of your suggestions ;) )

point 2: you're right...improved patch will follow

point 3: you're right to ;)
Comment 10 Felix Kaser 2008-08-16 12:05:58 UTC
Created attachment 116737 [details] [review]
improved patch
Comment 11 daniel g. siegel 2008-08-16 12:34:54 UTC
felix: if you could fix point 1, its ok for me to commit!

btw: 

there are a few warnings, which you should fix before committing:

cheese-dbus.c:79: warning: pointer targets in passing argument 4 of ‘org_freedesktop_DBus_request_name’ differ in signedness
cheese-dbus.c:90: warning: implicit declaration of function ‘exit’
cheese-dbus.c:90: warning: incompatible implicit declaration of built-in function ‘exit’


then: you probably should return false from the dbus object and do the cleanup and exit in cheese-window. you need to do at least the 

  g_free (cheese_window);
  gtk_main_quit ();

i think you should try something like:
  cheese_window->server = cheese_dbus_new ();
  if (!cheese_window->server) { exit, cleanup...}

seems all for now ;)
Comment 12 Felix Kaser 2008-08-16 12:40:53 UTC
I have no idea how point 1 can be fixed....can somebody help me with that? ideas?

The warning in line 79 is tricky! I tried to remove it a long time but I did not manage to do so. I'll look at it again...
Comment 13 Felix Kaser 2008-08-16 12:55:28 UTC
fixed warning in line 79!

I did not understand what you ment with return false... I'm doing this stuff in cheese_dbus_init, and that one has no return type!
Comment 14 daniel g. siegel 2008-08-16 13:02:36 UTC
you would have to do that in cheese_dbus_new
Comment 15 Felix Kaser 2008-08-16 16:14:20 UTC
Created attachment 116749 [details] [review]
new patch with urgency hint

this one should be fine...

i worked with gtk_window_set_urgency_hint, you can fight whats better, urgency hint or bring to front...can be changed with one single line of code i think!
Comment 16 Filippo Argiolas 2008-08-16 17:17:06 UTC
Ok, seems fine but.. urgency hint is never unset, so the taskbar starts blinking and never ends. Please fix it in the following way :
in cheese-window.c (pseudo-diff :P):

+static gboolean
+cheese_window_focus_in_cb (GtkWidget *window, GdkEventFocus *event, gpointer data)
+{
+  if (gtk_window_get_urgency_hint (GTK_WINDOW (window))) {
+      gtk_window_set_urgency_hint (GTK_WINDOW (window), FALSE);
+    }
+  return FALSE;
+}

(somewhere in _create_window)
+ gtk_widget_add_events (cheese_window->window, GDK_FOCUS_CHANGE_MASK);

(in _create_window too, near the other signal_connect-s)
+  g_signal_connect (cheese_window->window, "focus-in-event", 
+                    G_CALLBACK (cheese_window_focus_cb), NULL);

It should to the trick. The patch also needs some reindenting but I can do it before to commit.
Comment 17 Felix Kaser 2008-08-16 17:58:04 UTC
Created attachment 116753 [details] [review]
should solve the issue with gtk_window_present

we decided its better to use gtk_window_present and let the window manager do the rest!
Comment 18 Filippo Argiolas 2008-08-16 18:41:09 UTC
Thanks Felix, reviewed and commited ;)