Nux

Merge lp:~thomir-deactivatedaccount/nux/textentry-memory-leak-fix into lp:nux/2.0

Proposed by Thomi Richards
Status: Merged
Approved by: Jay Taoko
Approved revision: 607
Merged at revision: 609
Proposed branch: lp:~thomir-deactivatedaccount/nux/textentry-memory-leak-fix
Merge into: lp:nux/2.0
Diff against target: 195 lines (+26/-24)
1 file modified
Nux/TextEntry.cpp (+26/-24)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/nux/textentry-memory-leak-fix
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+99866@code.launchpad.net

This proposal supersedes a proposal from 2012-03-29.

Commit message

Don't leak the Layout instance when the TextEntry is destroyed.

Description of the change

Don't leak the Layout instance when the TextEntry is destroyed.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Looks reasonable to me.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-nux/96/console reported an error when processing this lp:~thomir/nux/textentry-memory-leak-fix branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-nux/96/console reported an error when processing this lp:~thomir/nux/textentry-memory-leak-fix branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-nux/101/console reported an error when processing this lp:~thomir/nux/textentry-memory-leak-fix branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/TextEntry.cpp'
2--- Nux/TextEntry.cpp 2012-03-17 08:50:58 +0000
3+++ Nux/TextEntry.cpp 2012-03-29 04:23:21 +0000
4@@ -155,7 +155,7 @@
5 #if defined(NUX_OS_LINUX)
6 , caret_cursor_(None)
7 , ime_(new IBusIMEContext(this))
8-#endif
9+#endif
10 , ime_active_(false)
11 , text_input_mode_(false)
12 , key_nav_mode_(false)
13@@ -201,6 +201,8 @@
14 if (ime_)
15 delete ime_;
16 #endif
17+ delete canvas_;
18+ ResetLayout();
19 }
20
21 void TextEntry::PreLayoutManagement()
22@@ -315,8 +317,8 @@
23 cursor_blink_status_ = 4;
24
25 // FIXME Have to get the current event fot he x11_keycode for ibus-hangul/korean input
26- nux::Event cur_event = nux::GetWindowThread()->GetGraphicsDisplay().GetCurrentEvent();
27- KeyEvent event((NuxEventType)event_type, keysym,cur_event.x11_keycode, state, character);
28+ nux::Event cur_event = nux::GetWindowThread()->GetGraphicsDisplay().GetCurrentEvent();
29+ KeyEvent event((NuxEventType)event_type, keysym,cur_event.x11_keycode, state, character);
30
31 #if defined(NUX_OS_LINUX)
32 im_filtered = ime_->FilterKeyEvent(event);
33@@ -336,8 +338,8 @@
34
35 if (event_type == NUX_KEYUP)
36 return;
37-
38-
39+
40+
41 // we need to ignore some characters
42 if (keysym == NUX_VK_TAB)
43 return;
44@@ -497,7 +499,7 @@
45 {
46 ProcessMouseEvent(NUX_MOUSE_MOVE, x, y, dx, dy, button_flags, key_flags);
47 }
48-
49+
50 void TextEntry::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags)
51 {
52 #if defined(NUX_OS_LINUX)
53@@ -505,7 +507,7 @@
54 {
55 Display* display = nux::GetGraphicsDisplay()->GetX11Display();
56 nux::BaseWindow* window = static_cast<nux::BaseWindow*>(GetTopLevelViewWindow());
57-
58+
59 if (display && window)
60 {
61 caret_cursor_ = XCreateFontCursor(display, XC_xterm);
62@@ -514,7 +516,7 @@
63 }
64 #endif
65 }
66-
67+
68 void TextEntry::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags)
69 {
70 #if defined(NUX_OS_LINUX)
71@@ -522,7 +524,7 @@
72 {
73 Display* display = nux::GetGraphicsDisplay()->GetX11Display();
74 nux::BaseWindow* window = static_cast<nux::BaseWindow*>(GetTopLevelViewWindow());
75-
76+
77 if (display && window)
78 {
79 XUndefineCursor(display, window->GetInputWindowId());
80@@ -608,7 +610,7 @@
81
82 bool TextEntry::HandledDeadKeys(int keysym, int state, const char* character)
83 {
84-#if defined(NUX_OS_LINUX)
85+#if defined(NUX_OS_LINUX)
86 /* Checks if the keysym between the first and last dead key */
87 if ((keysym >= XK_dead_grave) && (keysym <= XK_dead_stroke) && !dead_key_mode_)
88 {
89@@ -619,7 +621,7 @@
90 {
91 composition_mode_ = true;
92 composition_string_.clear();
93-
94+
95 dead_key_string_ = character;
96
97 std::string dead_key;
98@@ -636,7 +638,7 @@
99 return false;
100 #else
101 return false;
102-#endif
103+#endif
104 }
105
106 bool TextEntry::HandledComposition(int keysym, const char* character)
107@@ -664,9 +666,9 @@
108 composition_string_.clear();
109 return true;
110 }
111-
112+
113 composition_string_ += character;
114-
115+
116 std::string composition_match;
117
118 int match = LookForMatch(composition_match);
119@@ -692,11 +694,11 @@
120
121 return true;
122 }
123- }
124+ }
125 return false;
126 #else
127 return false;
128-#endif
129+#endif
130 }
131
132 void TextEntry::SetText(const char* text)
133@@ -840,7 +842,7 @@
134 need_im_reset_ = true;
135 #if defined(NUX_OS_LINUX)
136 ime_->Focus();
137-#endif
138+#endif
139 //gtk_im_context_focus_in(im_context_);
140 //UpdateIMCursorLocation();
141 }
142@@ -860,7 +862,7 @@
143 if (!readonly_ /*&& im_context_*/)
144 {
145 need_im_reset_ = true;
146-#if defined(NUX_OS_LINUX)
147+#if defined(NUX_OS_LINUX)
148 ime_->Blur();
149 #endif
150 //gtk_im_context_focus_out(im_context_);
151@@ -1260,7 +1262,7 @@
152 {
153 if (nux_compose_seqs_compact[i].compare(composition_string_) == 0)
154 {
155- // advance to the next sequence after ::
156+ // advance to the next sequence after ::
157 while (nux_compose_seqs_compact[++i].compare("::") != 0)
158 {
159 }
160@@ -1418,7 +1420,7 @@
161 }
162 if (!completion_.empty() && !wrap_)
163 {
164- attr = pango_attr_foreground_new(65535 * completion_color_.red,
165+ attr = pango_attr_foreground_new(65535 * completion_color_.red,
166 65535 * completion_color_.green,
167 65535 * completion_color_.blue);
168 attr->start_index = static_cast<guint>(pre_completion_length);
169@@ -2331,14 +2333,14 @@
170 // This will move the cursor one line up.
171 return true;
172 }
173-
174+
175 if (multiline_ && (key_sym == NUX_VK_DOWN))
176 {
177 // Navigate between the lines of the text entry.
178- // This will move the cursor one line down.
179+ // This will move the cursor one line down.
180 return true;
181 }
182-
183+
184 if ((!multiline_) && (!lose_key_focus_on_key_nav_direction_up_) && (key_sym == NUX_VK_UP))
185 {
186 // By returning true, the text entry signals that it want to receive the signal for this event.
187@@ -2415,7 +2417,7 @@
188 void TextEntry::SetLoseKeyFocusOnKeyNavDirectionDown(bool b)
189 {
190 lose_key_focus_on_key_nav_direction_down_ = b;
191- }
192+ }
193
194 bool TextEntry::GetLoseKeyFocusOnKeyNavDirectionDown() const
195 {

Subscribers

People subscribed via source and target branches

to all changes: