diff options
author | markt <markt> | 2007-11-08 18:05:05 (GMT) |
---|---|---|
committer | markt <markt> | 2007-11-08 18:05:05 (GMT) |
commit | 5db87437e6d1cb4c5bf6f3500c3f650b6b664ed1 (patch) | |
tree | 7f1a0feb13c1d914ac082e34280fb1902934b332 /src | |
parent | 54317a01037fe203b6f202bd6cc63f33a234cd5c (diff) | |
download | fluxbox-5db87437e6d1cb4c5bf6f3500c3f650b6b664ed1.zip fluxbox-5db87437e6d1cb4c5bf6f3500c3f650b6b664ed1.tar.bz2 |
fix crash bug when cycling focus
Diffstat (limited to 'src')
-rw-r--r-- | src/FocusControl.cc | 33 |
1 files changed, 18 insertions, 15 deletions
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 | ||
456 | void FocusControl::removeWindow(Focusable &win) { | 450 | void 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 | ||
462 | void FocusControl::shutdown() { | 465 | void FocusControl::shutdown() { |