Merge lp:~thomas-voss/compiz-core/fix-bad-get-and-missing-symbols into lp:compiz-core/0.9.5

Proposed by Thomas Voß
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 2923
Merged at revision: 2920
Proposed branch: lp:~thomas-voss/compiz-core/fix-bad-get-and-missing-symbols
Merge into: lp:compiz-core/0.9.5
Diff against target: 140 lines (+58/-13)
2 files modified
src/CMakeLists.txt (+10/-2)
src/screen.cpp (+48/-11)
To merge this branch: bzr merge lp:~thomas-voss/compiz-core/fix-bad-get-and-missing-symbols
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+89427@code.launchpad.net

Description of the change

Fixes a problem with missing symbols in plugins by building and installing a shared library libcompiz_core.
Fixes a problem with uncaught exceptions (boost::bad_get).

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I've a nagging feeling this isn't the best place to handle the exceptions. But it is better than not handling them.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/CMakeLists.txt'
2--- src/CMakeLists.txt 2012-01-18 17:05:12 +0000
3+++ src/CMakeLists.txt 2012-01-20 13:04:24 +0000
4@@ -59,7 +59,7 @@
5 ${CORE_MOD_LIBRARY_DIRS}
6 )
7
8-add_library (compiz_core
9+add_library (compiz_core SHARED
10 ${CMAKE_CURRENT_SOURCE_DIR}/global.cpp
11 ${CMAKE_CURRENT_SOURCE_DIR}/region.cpp
12 ${CMAKE_CURRENT_SOURCE_DIR}/atoms.cpp
13@@ -98,7 +98,7 @@
14 PROPERTY CORE_MOD_LIBRARIES)
15
16 target_link_libraries (
17- compiz_core
18+ compiz_core
19
20 ${COMPIZ_LIBRARIES}
21
22@@ -115,6 +115,7 @@
23 target_link_libraries (
24 compiz
25 compiz_core
26+
27 ${COMPIZ_LIBRARIES}
28
29 m
30@@ -128,6 +129,13 @@
31 )
32
33 install (
34+ TARGETS compiz_core
35+ RUNTIME DESTINATION ${COMPIZ_DESTDIR}${exec_prefix}
36+ LIBRARY DESTINATION ${COMPIZ_DESTDIR}${libdir}
37+ ARCHIVE DESTINATION ${COMPIZ_DESTDIR}${libdir}
38+)
39+
40+install (
41 TARGETS compiz
42 DESTINATION ${COMPIZ_DESTDIR}${exec_prefix}
43 )
44
45=== modified file 'src/screen.cpp'
46--- src/screen.cpp 2012-01-19 18:12:31 +0000
47+++ src/screen.cpp 2012-01-20 13:04:24 +0000
48@@ -791,15 +791,27 @@
49 pListCount++;
50 }
51
52+ CompString lpName;
53+
54 foreach (CompOption::Value &lp, list)
55 {
56 bool skip = false;
57- if (lp.s () == "core")
58+
59+ try
60+ {
61+ lpName = lp.s();
62+ } catch(const boost::bad_get&)
63+ {
64+ lpName.clear();
65+ }
66+
67+
68+ if (lpName == "core")
69 continue;
70
71 foreach (CompString &p, initialPlugins)
72 {
73- if (p == lp.s ())
74+ if (p == lpName)
75 {
76 skip = true;
77 break;
78@@ -839,20 +851,39 @@
79 {
80 std::list <CompString>::iterator it = initialPlugins.begin ();
81 bool skip = false;
82- if (opt.s () == "core")
83- continue;
84+
85+ try
86+ {
87+ if (opt.s () == "core")
88+ continue;
89+ } catch(const boost::bad_get&)
90+ {
91+ }
92
93 for (; it != initialPlugins.end (); it++)
94 {
95- if ((*it) == opt.s ())
96- {
97- skip = true;
98- break;
99- }
100+ try
101+ {
102+ if ((*it) == opt.s())
103+ {
104+ skip = true;
105+ break;
106+ }
107+ } catch (...)
108+ {
109+ }
110 }
111
112 if (!skip)
113- pList.at (j++).set (opt.s ());
114+ {
115+ try
116+ {
117+ pList.at (j++).set (opt.s ());
118+ } catch(const boost::bad_get&)
119+ {
120+ j++;
121+ }
122+ }
123 }
124
125 assert (j == pList.size ());
126@@ -902,7 +933,13 @@
127
128 if (p == 0 && !failedPush)
129 {
130- p = CompPlugin::load (pList[i].s ().c_str ());
131+ try
132+ {
133+ p = CompPlugin::load (pList[i].s ().c_str ());
134+ } catch (...)
135+ {
136+ }
137+
138 if (p)
139 {
140 if (!CompPlugin::push (p))

Subscribers

People subscribed via source and target branches