summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-02-26 22:34:49 (GMT)
committerfluxgen <fluxgen>2002-02-26 22:34:49 (GMT)
commit6f1a0490c4bdb4e04658205e5339eaa47d238279 (patch)
tree4d1100d6ddbce57b454a848f8d476c9bfc338c8d
parent8d911dcbddc22bea0cf453c333a9b0d7b5f3e783 (diff)
downloadfluxbox_lack-6f1a0490c4bdb4e04658205e5339eaa47d238279.zip
fluxbox_lack-6f1a0490c4bdb4e04658205e5339eaa47d238279.tar.bz2
added infinite loop check in transient
-rw-r--r--src/Workspace.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 3a2697e..e136c32 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Workspace.cc,v 1.11 2002/02/16 11:28:16 fluxgen Exp $ 25// $Id: Workspace.cc,v 1.12 2002/02/26 22:34:49 fluxgen Exp $
26 26
27// use GNU extensions 27// use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -188,12 +188,14 @@ void Workspace::removeAll(void) {
188void Workspace::raiseWindow(FluxboxWindow *w) { 188void Workspace::raiseWindow(FluxboxWindow *w) {
189 FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w; 189 FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
190 190
191 while (bottom->isTransient() && bottom->getTransientFor()) 191 while (bottom->isTransient() && bottom->getTransientFor() &&
192 bottom->getTransientFor() != bottom) //prevent infinite loop
192 bottom = bottom->getTransientFor(); 193 bottom = bottom->getTransientFor();
193 194
194 int i = 1; 195 int i = 1;
195 win = bottom; 196 win = bottom;
196 while (win->hasTransient() && win->getTransient()) { 197 while (win->hasTransient() && win->getTransient() &&
198 win->getTransient() != win) {//prevent infinite loop
197 win = win->getTransient(); 199 win = win->getTransient();
198 200
199 i++; 201 i++;
@@ -213,9 +215,10 @@ void Workspace::raiseWindow(FluxboxWindow *w) {
213 wkspc->stackingList.push_front(win); 215 wkspc->stackingList.push_front(win);
214 } 216 }
215 217
216 if (! win->hasTransient() || ! win->getTransient()) 218 if (! win->hasTransient() || ! win->getTransient() ||
219 win->getTransient() == win) //prevent infinite loop
217 break; 220 break;
218 221
219 win = win->getTransient(); 222 win = win->getTransient();
220 } 223 }
221 224
@@ -224,16 +227,17 @@ void Workspace::raiseWindow(FluxboxWindow *w) {
224 delete [] nstack; 227 delete [] nstack;
225} 228}
226 229
227
228void Workspace::lowerWindow(FluxboxWindow *w) { 230void Workspace::lowerWindow(FluxboxWindow *w) {
229 FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w; 231 FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
230 232
231 while (bottom->isTransient() && bottom->getTransientFor()) 233 while (bottom->isTransient() && bottom->getTransientFor()
234 && bottom->getTransientFor() != bottom) //prevent infinite loop
232 bottom = bottom->getTransientFor(); 235 bottom = bottom->getTransientFor();
233 236
234 int i = 1; 237 int i = 1;
235 win = bottom; 238 win = bottom;
236 while (win->hasTransient() && win->getTransient()) { 239 while (win->hasTransient() && win->getTransient() &&
240 win->getTransient() != win) { //prevent infinite loop
237 win = win->getTransient(); 241 win = win->getTransient();
238 242
239 i++; 243 i++;
@@ -252,7 +256,8 @@ void Workspace::lowerWindow(FluxboxWindow *w) {
252 wkspc->stackingList.push_back(win); 256 wkspc->stackingList.push_back(win);
253 } 257 }
254 258
255 if (! win->getTransientFor()) 259 if (! win->getTransientFor() ||
260 win->getTransientFor() == win)//prevent infinite loop
256 break; 261 break;
257 262
258 win = win->getTransientFor(); 263 win = win->getTransientFor();