summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2011-09-19 09:19:40 +0300
committerYonit Halperin <yhalperi@redhat.com>2011-09-19 12:06:45 +0300
commit282349dda2b7d09fd9b5ee58fac59bada1bb26a3 (patch)
tree067988c0ee02d09b39a6fe11584a325736656ff6
parentb52be16ca3a5b2c76acdfbd8b3f72d51f8b85e97 (diff)
client: display channel - destroy all surfaces on disconnect0.8.mig.v2
Fix not destroying surfaces and other data (e.g., streams) upon disconnection.
-rw-r--r--client/display_channel.cpp18
-rw-r--r--client/display_channel.h1
2 files changed, 13 insertions, 6 deletions
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index aa4b52b..1da4ebb 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -1041,9 +1041,7 @@ void DisplayChannel::on_disconnect()
_surfaces_cache[0]->clear();
}
- if (screen()) {
- screen()->set_update_interrupt_trigger(NULL);
- }
+ clear();
AutoRef<DetachChannelsEvent> detach_channels(new DetachChannelsEvent(*this));
get_client().push_event(*detach_channels);
@@ -1052,7 +1050,6 @@ void DisplayChannel::on_disconnect()
get_client().push_event(*unlock_event);
detach_from_screen(get_client().get_application());
}
- get_client().deactivate_interval_timer(*_streams_timer);
AutoRef<SyncEvent> sync_event(new SyncEvent());
get_client().push_event(*sync_event);
(*sync_event)->wait();
@@ -1108,7 +1105,7 @@ void DisplayChannel::destroy_off_screen_surfaces()
}
}
-void DisplayChannel::on_disconnect_mig_src()
+void DisplayChannel::clear(bool destroy_primary)
{
_palette_cache.clear();
destroy_streams();
@@ -1118,7 +1115,16 @@ void DisplayChannel::on_disconnect_mig_src()
_update_mark = 0;
_next_timer_time = 0;
get_client().deactivate_interval_timer(*_streams_timer);
- destroy_off_screen_surfaces();
+ if (destroy_primary) {
+ destroy_all_surfaces();
+ } else {
+ destroy_off_screen_surfaces();
+ }
+}
+
+void DisplayChannel::on_disconnect_mig_src()
+{
+ clear(false);
// Not clrearing the primary surface till we receive a new one (or a timeout).
if (_surfaces_cache.exist(0)) {
AutoRef<MigPrimarySurfaceTimer> mig_timer(new MigPrimarySurfaceTimer());
diff --git a/client/display_channel.h b/client/display_channel.h
index 755bf25..63eae5b 100644
--- a/client/display_channel.h
+++ b/client/display_channel.h
@@ -179,6 +179,7 @@ private:
void activate_streams_timer();
void stream_update_request(uint32_t update_time);
void reset_screen();
+ void clear(bool destroy_primary = true);
static void set_clip_rects(const SpiceClip& clip, uint32_t& num_clip_rects, SpiceRect*& clip_rects);