summaryrefslogtreecommitdiffstats
path: root/client/display_channel.cpp
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-09-16 08:56:38 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-09-19 18:33:33 +0200
commit26e172e4beccee39f842610bd0047f692e4a5afe (patch)
treeadef1d129e1849e0c6aec5773b50c35b67927d2d /client/display_channel.cpp
parent6a200503521c4187fe9d3c3413283ce3c17f02f4 (diff)
downloadspice-26e172e4beccee39f842610bd0047f692e4a5afe.tar.gz
spice-26e172e4beccee39f842610bd0047f692e4a5afe.tar.xz
spice-26e172e4beccee39f842610bd0047f692e4a5afe.zip
client: don't crash when booting a Xinerama setup
In a Xinerama setup, when X starts up and creates one of the secondary screens, first a non-primary surface is created on the secondary screen, and then the primary surface for this screen is created. This causes a crash when the guest uses Xinerama and the client is attached to the VM before X starts (ie while the guest is booting). This happens because DisplayChannel::create_canvas (which is called when creating a non-primary surface) assumes a screen has already been set for the DisplayChannel while this only happens upon primary surface creation. However, it uses the screen for non important stuff, so we can test if screen() is non NULL before using it. This is what is done in other parts of this file. Fixes rhbz #732423
Diffstat (limited to 'client/display_channel.cpp')
-rw-r--r--client/display_channel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 3b8b91a4..5ab74936 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -1165,13 +1165,15 @@ void DisplayChannel::create_canvas(int surface_id, const std::vector<int>& canva
#endif
unsigned int i;
+ if (screen()) {
#ifdef USE_OPENGL
- if (screen()->need_recreate_context_gl()) {
- recreate = false;
- }
+ if (screen()->need_recreate_context_gl()) {
+ recreate = false;
+ }
#endif
- screen()->set_update_interrupt_trigger(NULL);
+ screen()->set_update_interrupt_trigger(NULL);
+ }
for (i = 0; i < canvas_types.size(); i++) {