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 624197 - [patch] port to GtkApplication
[patch] port to GtkApplication
Status: RESOLVED FIXED
Product: devhelp
Classification: Applications
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: devhelp-maint
devhelp-maint
Depends on:
Blocks:
 
 
Reported: 2010-07-12 20:53 UTC by Saleem Abdulrasool
Modified: 2010-11-18 10:08 UTC
See Also:
GNOME target: 3.0
GNOME version: ---


Attachments
0001-port-to-GtkApplication.patch (9.59 KB, patch)
2010-07-12 20:53 UTC, Saleem Abdulrasool
needs-work Details | Review
0001-port-to-GtkApplication.patch (9.59 KB, patch)
2010-07-17 22:56 UTC, Saleem Abdulrasool
none Details | Review
0001-port-to-GApplication.patch (9.53 KB, patch)
2010-07-31 17:07 UTC, Saleem Abdulrasool
none Details | Review

Description Saleem Abdulrasool 2010-07-12 20:53:45 UTC
Created attachment 165759 [details] [review]
0001-port-to-GtkApplication.patch

The attached patch ports devhelp from unique to GtkApplication to provide the same functionality.
Comment 1 Frederic Peters 2010-07-17 13:54:11 UTC
Review of attachment 165759 [details] [review]:

Thanks for working on this; here is a quick review of things I could easily spot.

::: configure.ac
@@ -66,3 @@
   gtk+-3.0
   webkitgtk-3.0
-  unique-3.0

Since you are now using methods from a newer glib you should add an explicit check for glib-2.0 >= 2.25.11

::: src/dh-main.c
@@ +227,3 @@
+	for (i = 0; i < G_N_ELEMENTS (commands); i++) {
+		g_application_add_action (application, commands[i].name, commands[i].name);
+	}

You could add a new member to commands, to hold a description, so the description is not just the command name.

@@ +244,3 @@
+		argv_bytes = (guint8 *) argv[i];
+		g_variant_builder_add_value (&builder,
+					     g_variant_new_byte_array (argv_bytes, -1));

glib d9e90c38 (July 7th) removed g_variant_new_byte_array.

@@ +333,3 @@
+				      "argv", variant_from_argv (argc, argv),
+				      "default-quit", FALSE,
+				      NULL);

And I think your variant_from_argv could be replaced by a call to g_variant_new_bytestring_array.
Comment 2 Saleem Abdulrasool 2010-07-17 22:55:21 UTC
(In reply to comment #1)
> Review of attachment 165759 [details] [review]:
> 
> Thanks for working on this; here is a quick review of things I could easily
> spot.
> 
> ::: configure.ac
> @@ -66,3 @@
>    gtk+-3.0
>    webkitgtk-3.0
> -  unique-3.0
> 
> Since you are now using methods from a newer glib you should add an explicit
> check for glib-2.0 >= 2.25.11

Unstaged that hunk accidentally it seems.

> ::: src/dh-main.c
> @@ +227,3 @@
> +    for (i = 0; i < G_N_ELEMENTS (commands); i++) {
> +        g_application_add_action (application, commands[i].name,
> commands[i].name);
> +    }
> 
> You could add a new member to commands, to hold a description, so the
> description is not just the command name.

Sounds like a good idea.  Done.

> @@ +244,3 @@
> +        argv_bytes = (guint8 *) argv[i];
> +        g_variant_builder_add_value (&builder,
> +                         g_variant_new_byte_array (argv_bytes, -1));
> 
> glib d9e90c38 (July 7th) removed g_variant_new_byte_array.
> 
> @@ +333,3 @@
> +                      "argv", variant_from_argv (argc, argv),
> +                      "default-quit", FALSE,
> +                      NULL);
> 
> And I think your variant_from_argv could be replaced by a call to
> g_variant_new_bytestring_array.

These changes are part of 2.25.11, which was released after I wrote the patch.  However, since it is out now, so, updated.
Comment 3 Saleem Abdulrasool 2010-07-17 22:56:49 UTC
Created attachment 166101 [details] [review]
0001-port-to-GtkApplication.patch
Comment 4 Frederic Peters 2010-07-18 06:31:24 UTC
Thanks for your quick reaction; I get this segfault when I have a devhelp instance started and send a command to it (running "devhelp -q" in another shell, for example).

Can you reproduce it?

Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:31
31	../sysdeps/x86_64/multiarch/../strlen.S: Aucun fichier ou dossier de ce type.
	in ../sysdeps/x86_64/multiarch/../strlen.S

(gdb) bt
  • #0 __strlen_sse2
    at ../sysdeps/x86_64/multiarch/../strlen.S line 31
  • #1 g_strdup
    at gstrfuncs.c line 100
  • #2 value_collect_string
    at gvaluetypes.c line 292
  • #3 g_signal_emit_valist
    at gsignal.c line 2958
  • #4 g_signal_emit
    at gsignal.c line 3040
  • #5 gtk_application_default_action_with_data
    at gtkapplication.c line 189
  • #6 _gio_marshal_VOID__STRING_VARIANT
    at gio-marshal.c line 162
  • #7 g_type_class_meta_marshal
    at gclosure.c line 877
  • #8 g_closure_invoke
    at gclosure.c line 766
  • #9 signal_emit_unlocked_R
    at gsignal.c line 3182
  • #10 g_signal_emit_valist
    at gsignal.c line 2983
  • #11 g_signal_emit
    at gsignal.c line 3040
  • #12 application_dbus_method_call
    at gdbusapplication.c line 90
  • #13 call_in_idle_cb
    at gdbusconnection.c line 4218
  • #14 g_idle_dispatch
    at gmain.c line 4224
  • #15 g_main_dispatch
    at gmain.c line 2119
  • #16 g_main_context_dispatch
    at gmain.c line 2672
  • #17 g_main_context_iterate
    at gmain.c line 2750
  • #18 g_main_loop_run
    at gmain.c line 2958
  • #19 gtk_main
    at gtkmain.c line 1202
  • #20 gtk_application_default_run
    at gtkapplication.c line 126
  • #21 g_application_run
    at gapplication.c line 886
  • #22 gtk_application_run
    at gtkapplication.c line 491
  • #23 main
    at dh-main.c line 380

Comment 5 Saleem Abdulrasool 2010-07-18 07:36:49 UTC
(In reply to comment #4)
> Thanks for your quick reaction; I get this segfault when I have a devhelp
> instance started and send a command to it (running "devhelp -q" in another
> shell, for example).
> 
> Can you reproduce it?

No, I cant reproduce it.  I have a feeling that using GApplication instead of GtkApplication will prevent this (had a similar issue with totem).  Ive tried multiple times, all the commands actually work for me (tried replacing the installed version with the patched version, still nothing, inside or outside of gdb).  I wonder if there is a distro-specific patch that is causing this disparity in behaviour?

> Program received signal SIGSEGV, Segmentation fault.
> __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:31
> 31    ../sysdeps/x86_64/multiarch/../strlen.S: Aucun fichier ou dossier de ce
> type.
>     in ../sysdeps/x86_64/multiarch/../strlen.S
> 
> (gdb) bt
>
Comment 6 Saleem Abdulrasool 2010-07-31 17:07:08 UTC
Created attachment 166894 [details] [review]
0001-port-to-GApplication.patch

Can you please try this patch?  It simply uses GApplication rather than GtkApplication.
Comment 7 Frederic Peters 2010-08-02 14:50:09 UTC
Thanks, it works fine; I pushed it to both master and the new gnome-2-32 branch.
Comment 8 Aleksander Morgado 2010-11-18 10:08:27 UTC
GApplication API changed in GLib commit http://git.gnome.org/browse/glib/commit/?id=a7923a4aa3ff6d67672c6c69cd1b7d70fba9c57d

So the pushed patch is now preventing a proper build of Devhelp, see bug 635162