Nux

Merge lp:~loic.molinari/nux/nux-clean-up-at-destruction into lp:nux

Proposed by Loïc Molinari
Status: Merged
Merged at revision: 300
Proposed branch: lp:~loic.molinari/nux/nux-clean-up-at-destruction
Merge into: lp:nux
Diff against target: 44 lines (+7/-2)
2 files modified
Nux/WindowThread.cpp (+6/-2)
Nux/WindowThread.h (+1/-0)
To merge this branch: bzr merge lp:~loic.molinari/nux/nux-clean-up-at-destruction
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+55511@code.launchpad.net

Description of the change

Clean up X11 connection source at WindowThread destruction.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

assuming there is no way to call ~WindowThread without getting InitGlibLoop () (and so Run () and RunUserInterface()), approved! other, init it to 0 in the constructor

review: Approve
210. By Loïc Molinari

Init'd source ID to 0 at contruction and renamed it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/WindowThread.cpp'
2--- Nux/WindowThread.cpp 2011-03-22 12:13:28 +0000
3+++ Nux/WindowThread.cpp 2011-03-30 14:40:03 +0000
4@@ -247,9 +247,9 @@
5 g_source_set_callback (source, 0, this, 0);
6
7 if (IsEmbeddedWindow ())
8- g_source_attach (source, NULL);
9+ m_event_source_id = g_source_attach (source, NULL);
10 else
11- g_source_attach (source, m_GLibContext);
12+ m_event_source_id = g_source_attach (source, m_GLibContext);
13
14 if (_Timelines->size () > 0)
15 StartMasterClock ();
16@@ -386,6 +386,7 @@
17 , m_embedded_window (false)
18 , m_size_configuration_event (false)
19 , m_force_redraw (false)
20+ , m_event_source_id (0)
21 {
22 // Thread specific objects
23 _graphics_display = 0;
24@@ -443,6 +444,9 @@
25
26 WindowThread::~WindowThread()
27 {
28+ if (m_event_source_id != 0)
29+ g_source_remove (m_event_source_id);
30+
31 ThreadDtor();
32 std::list<Timeline*>::iterator li;
33 for (li=_Timelines->begin (); li!=_Timelines->end (); ++li)
34
35=== modified file 'Nux/WindowThread.h'
36--- Nux/WindowThread.h 2011-03-22 12:13:28 +0000
37+++ Nux/WindowThread.h 2011-03-30 14:40:03 +0000
38@@ -583,6 +583,7 @@
39 #if (defined(NUX_OS_LINUX) || defined(NUX_USE_GLIB_LOOP_ON_WINDOWS)) && (!defined(NUX_DISABLE_GLIB_LOOP))
40 GMainLoop *m_GLibLoop;
41 GMainContext *m_GLibContext;
42+ guint32 m_event_source_id;
43 friend gboolean nux_event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data);
44 friend gboolean nux_timeout_dispatch (gpointer user_data);
45

Subscribers

People subscribed via source and target branches