diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp index d56149ae9708..ed15b8201c58 100644 --- a/widget/gtk/nsAppShell.cpp +++ b/widget/gtk/nsAppShell.cpp @@ -169,17 +169,22 @@ nsresult nsAppShell::Init() { } else { screenManager.SetHelper(mozilla::MakeUnique()); } - } - if (gtk_check_version(3, 16, 3) == nullptr) { - // Before 3.16.3, GDK cannot override classname by --class command line - // option when program uses gdk_set_program_class(). - // - // See https://bugzilla.gnome.org/show_bug.cgi?id=747634 - nsAutoString brandName; - mozilla::widget::WidgetUtils::GetBrandShortName(brandName); - if (!brandName.IsEmpty()) { - gdk_set_program_class(NS_ConvertUTF16toUTF8(brandName).get()); + if (gtk_check_version(3, 16, 3) == nullptr) { + // Before 3.16.3, GDK cannot override classname by --class command line + // option when program uses gdk_set_program_class(). + // + // See https://bugzilla.gnome.org/show_bug.cgi?id=747634 + // + // Only bother doing this for the parent process, since it's the one + // creating top-level windows. (At this point, a child process hasn't + // received the list of registered chrome packages, so the + // GetBrandShortName call would fail anyway.) + nsAutoString brandName; + mozilla::widget::WidgetUtils::GetBrandShortName(brandName); + if (!brandName.IsEmpty()) { + gdk_set_program_class(NS_ConvertUTF16toUTF8(brandName).get()); + } } }