Merge lp:~raof/netbook-remix-launcher/fix-bug-467474 into lp:netbook-remix-launcher

Proposed by Chris Halse Rogers
Status: Merged
Merged at revision: not available
Proposed branch: lp:~raof/netbook-remix-launcher/fix-bug-467474
Merge into: lp:netbook-remix-launcher
Diff against target: 97 lines (+37/-7)
3 files modified
src/main.c (+21/-7)
src/nl-window.c (+14/-0)
src/nl-window.h (+2/-0)
To merge this branch: bzr merge lp:~raof/netbook-remix-launcher/fix-bug-467474
Reviewer Review Type Date Requested Status
UNR Developers Pending
Review via email: mp+21349@code.launchpad.net

Description of the change

Check that clutter has successfully initialised the stage in nl-window's constructed method; bail if the stage isn't correctly initialised, as the subsequent calls are guaranteed to fail, and in the case of bug #467474 results in segfaults in libGL.

If this happens, catch the invalid nl-window in main.c, and spawn netbook-launcher-efl.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/main.c'
--- src/main.c 2010-02-17 16:51:06 +0000
+++ src/main.c 2010-03-15 05:31:13 +0000
@@ -241,6 +241,20 @@
241 return TRUE;241 return TRUE;
242}242}
243243
244static gint
245fallback_to_efl (void)
246{
247 GError *error = NULL;
248
249 if (!g_spawn_command_line_async ("/usr/bin/netbook-launcher-efl", &error))
250 {
251 g_print ("Error in netbook-launcher-efl: %s\n", error->message);
252 g_error_free (error);
253 return EXIT_FAILURE;
254 }
255 return 0;
256}
257
244gint258gint
245main (gint argc, gchar *argv[])259main (gint argc, gchar *argv[])
246{260{
@@ -269,13 +283,7 @@
269 {283 {
270 g_print ("No rendering avaible for netbook-launcher, try to run netbook-launcher-efl\n");284 g_print ("No rendering avaible for netbook-launcher, try to run netbook-launcher-efl\n");
271 285
272 if (!g_spawn_command_line_async ("/usr/bin/netbook-launcher-efl", &error))286 return fallback_to_efl ();
273 {
274 g_print ("Error in netbook-launcher-efl: %s\n", error->message);
275 g_error_free (error);
276 return EXIT_FAILURE;
277 }
278 return 0;
279 }287 }
280288
281 if (!notify_init ("Netbook Launcher"))289 if (!notify_init ("Netbook Launcher"))
@@ -380,6 +388,12 @@
380 /* Create the nl window */388 /* Create the nl window */
381 window = nl_window_get_default ();389 window = nl_window_get_default ();
382390
391 if (!nl_window_is_valid (window))
392 {
393 g_print ("Error creating clutter launcher. Trying to run netbook-launcher-efl\n");
394 return fallback_to_efl ();
395 }
396
383 plugin_manager = nl_plugin_manager_new (NL_SHELL (window));397 plugin_manager = nl_plugin_manager_new (NL_SHELL (window));
384 folders_source = nl_folders_source_new (NL_SHELL (window));398 folders_source = nl_folders_source_new (NL_SHELL (window));
385 volumes_source = nl_volumes_source_new (NL_SHELL (window));399 volumes_source = nl_volumes_source_new (NL_SHELL (window));
386400
=== modified file 'src/nl-window.c'
--- src/nl-window.c 2010-03-11 07:14:00 +0000
+++ src/nl-window.c 2010-03-15 05:31:13 +0000
@@ -192,6 +192,12 @@
192 priv->stage = gtk_clutter_embed_get_stage192 priv->stage = gtk_clutter_embed_get_stage
193 (GTK_CLUTTER_EMBED (priv->gtkclutter));193 (GTK_CLUTTER_EMBED (priv->gtkclutter));
194194
195 // Given sufficiently poor OpenGL drivers getting the stage
196 // can fail. In this case, there's a good chance that further
197 // OpenGL calls will fail, sometimes spectacularly.
198 // See LP: #467474 for an example.
199 g_return_if_fail (CLUTTER_IS_STAGE (priv->stage));
200
195 /* Set NlWidget's direction */201 /* Set NlWidget's direction */
196 direction = gtk_widget_get_default_direction ();202 direction = gtk_widget_get_default_direction ();
197 ctk_actor_set_default_direction (direction);203 ctk_actor_set_default_direction (direction);
@@ -370,6 +376,14 @@
370 return window;376 return window;
371}377}
372378
379gboolean
380nl_window_is_valid (GtkWidget *window)
381{
382 // This is not all of the state required to declare a window valid, but
383 // it's enough to LP: #467474
384 return CLUTTER_IS_STAGE (NL_WINDOW (window)->priv->stage);
385}
386
373/*387/*
374 * Private methods388 * Private methods
375 */389 */
376390
=== modified file 'src/nl-window.h'
--- src/nl-window.h 2009-07-23 13:45:56 +0000
+++ src/nl-window.h 2010-03-15 05:31:13 +0000
@@ -61,6 +61,8 @@
6161
62GtkWidget * nl_window_get_default (void);62GtkWidget * nl_window_get_default (void);
6363
64gboolean nl_window_is_valid (GtkWidget *window);
65
64void nl_window_set_transient (NlWindow *self, GtkWindow *window);66void nl_window_set_transient (NlWindow *self, GtkWindow *window);
6567
66#endif /* _NL_WINDOW_H_ */68#endif /* _NL_WINDOW_H_ */

Subscribers

People subscribed via source and target branches