Nux

Merge lp:~gordallott/nux/nux-fix-sigsevs into lp:nux

Proposed by Gord Allott
Status: Merged
Approved by: Neil J. Patel
Approved revision: 290
Merged at revision: 294
Proposed branch: lp:~gordallott/nux/nux-fix-sigsevs
Merge into: lp:nux
Diff against target: 63 lines (+27/-0)
3 files modified
Nux/WindowThread.cpp (+18/-0)
Nux/WindowThread.h (+2/-0)
NuxImage/CairoGraphics.cpp (+7/-0)
To merge this branch: bzr merge lp:~gordallott/nux/nux-fix-sigsevs
Reviewer Review Type Date Requested Status
Neil J. Patel Pending
Review via email: mp+54577@code.launchpad.net

Description of the change

Just fixes a few crashers in nux

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
1=== modified file 'Nux/WindowThread.cpp'
2--- Nux/WindowThread.cpp 2011-03-20 04:03:32 +0000
3+++ Nux/WindowThread.cpp 2011-03-23 18:16:46 +0000
4@@ -461,9 +461,27 @@
5 return;
6
7 if (_focused_area != NULL)
8+ {
9 _focused_area->SetFocused (false);
10+
11+ if (_focused_area_destroyed_con.empty () == false)
12+ {
13+ _focused_area_destroyed_con.disconnect ();
14+ }
15+
16+ }
17
18 _focused_area = focused_area;
19+ _focused_area_destroyed_con = focused_area->OnDestroyed.connect (sigc::mem_fun (this, &WindowThread::OnFocusedAreaDestroyed));
20+
21+ }
22+
23+ void WindowThread::OnFocusedAreaDestroyed (Object *object)
24+ {
25+ if (object == _focused_area)
26+ {
27+ _focused_area = NULL;
28+ }
29 }
30
31 void WindowThread::AsyncWakeUpCallback (void* data)
32
33=== modified file 'Nux/WindowThread.h'
34--- Nux/WindowThread.h 2011-03-17 14:47:06 +0000
35+++ Nux/WindowThread.h 2011-03-23 18:16:46 +0000
36@@ -469,7 +469,9 @@
37 std::list< ThreadInfo * > m_ChildThreadInfo;
38
39 private:
40+ void OnFocusedAreaDestroyed (Object *object);
41 Area *_focused_area;
42+ sigc::connection _focused_area_destroyed_con;
43 //! Informs the system of the start of a layout cycle.
44 /*!
45 This call merely sets a flag to true or false. This flag is used to decided if some actions should be
46
47=== modified file 'NuxImage/CairoGraphics.cpp'
48--- NuxImage/CairoGraphics.cpp 2011-03-22 10:11:36 +0000
49+++ NuxImage/CairoGraphics.cpp 2011-03-23 18:16:46 +0000
50@@ -123,6 +123,13 @@
51 t_u8 *ptr = cairo_image_surface_get_data (_cairo_surface);
52 int stride = cairo_image_surface_get_stride (_cairo_surface);
53
54+ if (ptr == NULL || stride == 0)
55+ {
56+ // _cairo_surface is not a valid surface
57+ nuxError (TEXT ("[CairoGraphics::GetBitmap] Invalid surface"));
58+ return bitmap_data; // just returns because we will segfault otherwise
59+ }
60+
61 if (m_surface_format == CAIRO_FORMAT_A1)
62 {
63 t_u8 *temp = new t_u8[bitmap_data->GetSurface (0).GetPitch() ];

Subscribers

People subscribed via source and target branches