aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2007-11-08 18:05:05 (GMT)
committermarkt <markt>2007-11-08 18:05:05 (GMT)
commit5db87437e6d1cb4c5bf6f3500c3f650b6b664ed1 (patch)
tree7f1a0feb13c1d914ac082e34280fb1902934b332
parent54317a01037fe203b6f202bd6cc63f33a234cd5c (diff)
downloadfluxbox_pavel-5db87437e6d1cb4c5bf6f3500c3f650b6b664ed1.zip
fluxbox_pavel-5db87437e6d1cb4c5bf6f3500c3f650b6b664ed1.tar.bz2
fix crash bug when cycling focus
-rw-r--r--ChangeLog3
-rw-r--r--src/FocusControl.cc33
2 files changed, 21 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index c081b80..089264d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0.1: 2Changes for 1.0.1:
3*07/11/08:
4 * Fix crash when cycling focus and window closes, bug #1787345 (Mark)
5 FocusControl.cc
3*07/11/04: 6*07/11/04:
4 * Update autoraise delay on reconfigure (Mark) 7 * Update autoraise delay on reconfigure (Mark)
5 Window.cc 8 Window.cc
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index 4aa896b..8e6b895 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -137,6 +137,7 @@ void FocusControl::cycleFocus(const Focusables &window_list,
137 if (!doSkipWindow(**it, pat) && (*it)->focus()) 137 if (!doSkipWindow(**it, pat) && (*it)->focus())
138 break; 138 break;
139 } 139 }
140 m_cycling_window = it;
140 141
141 // if we're still in the same fbwin, there's nothing else to do 142 // if we're still in the same fbwin, there's nothing else to do
142 if (m_cycling_last && m_cycling_last->fbwindow() == fbwin) 143 if (m_cycling_last && m_cycling_last->fbwindow() == fbwin)
@@ -159,7 +160,6 @@ void FocusControl::cycleFocus(const Focusables &window_list,
159 if (!isCycling()) 160 if (!isCycling())
160 fbwin->raise(); 161 fbwin->raise();
161 162
162 m_cycling_window = it;
163 m_cycling_last = last_client; 163 m_cycling_last = last_client;
164 m_was_iconic = was_iconic; 164 m_was_iconic = was_iconic;
165 165
@@ -242,18 +242,14 @@ void FocusControl::stopCyclingFocus() {
242 if (m_cycling_list == 0) 242 if (m_cycling_list == 0)
243 return; 243 return;
244 244
245 Focusables::const_iterator it_end = m_cycling_list->end();
246 m_cycling_last = 0; 245 m_cycling_last = 0;
247 m_cycling_list = 0; 246 m_cycling_list = 0;
248 247
249 // put currently focused window to top 248 // put currently focused window to top
250 // the iterator may be invalid if the window died 249 if (s_focused_window) {
251 // in which case we'll do a proper revert focus 250 setScreenFocusedWindow(*s_focused_window);
252 if (m_cycling_window != it_end && (*m_cycling_window)->fbwindow() && 251 if (s_focused_fbwindow)
253 (*m_cycling_window)->fbwindow()->isVisible()) { 252 s_focused_fbwindow->raise();
254 (*m_cycling_window)->fbwindow()->raise();
255 if (s_focused_window)
256 setScreenFocusedWindow(*s_focused_window);
257 } else 253 } else
258 revertFocus(m_screen); 254 revertFocus(m_screen);
259} 255}
@@ -439,24 +435,31 @@ void FocusControl::removeClient(WinClient &client) {
439 if (client.screen().isShuttingdown()) 435 if (client.screen().isShuttingdown())
440 return; 436 return;
441 437
442 Focusable *cyc = 0;
443 if (m_cycling_list && m_cycling_window != m_cycling_list->end())
444 cyc = *m_cycling_window;
445
446 m_focused_list.remove(&client); 438 m_focused_list.remove(&client);
447 m_creation_order_list.remove(&client); 439 m_creation_order_list.remove(&client);
448 client.screen().clientListSig().notify(); 440 client.screen().clientListSig().notify();
449 441
450 if (cyc == &client) { 442 if (m_cycling_list && m_cycling_window != m_cycling_list->end() &&
443 *m_cycling_window == &client) {
451 m_cycling_window = m_cycling_list->end(); 444 m_cycling_window = m_cycling_list->end();
452 stopCyclingFocus(); 445 stopCyclingFocus();
453 } 446 } else if (m_cycling_last == &client)
447 m_cycling_last = 0;
454} 448}
455 449
456void FocusControl::removeWindow(Focusable &win) { 450void FocusControl::removeWindow(Focusable &win) {
451 if (win.screen().isShuttingdown())
452 return;
453
457 m_focused_win_list.remove(&win); 454 m_focused_win_list.remove(&win);
458 m_creation_order_win_list.remove(&win); 455 m_creation_order_win_list.remove(&win);
459 win.screen().clientListSig().notify(); 456 win.screen().clientListSig().notify();
457
458 if (m_cycling_list && m_cycling_window != m_cycling_list->end() &&
459 *m_cycling_window == &win) {
460 m_cycling_window = m_cycling_list->end();
461 stopCyclingFocus();
462 }
460} 463}
461 464
462void FocusControl::shutdown() { 465void FocusControl::shutdown() {