mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
fix problem with remove_window() removing too many windows
This commit is contained in:
parent
3572444a67
commit
cf6a95c0ed
@ -359,6 +359,9 @@ remove_window(GraphicsOutput *window) {
|
||||
size_t count;
|
||||
{
|
||||
MutexHolder holder(_lock);
|
||||
if (!_windows_sorted) {
|
||||
do_resort_windows();
|
||||
}
|
||||
count = _windows.erase(ptwin);
|
||||
}
|
||||
if (count == 0) {
|
||||
@ -367,6 +370,8 @@ remove_window(GraphicsOutput *window) {
|
||||
}
|
||||
|
||||
do_remove_window(window);
|
||||
|
||||
nassertr(count == 1, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1167,6 +1172,7 @@ do_resort_windows() {
|
||||
RenderThread *thread = (*ti).second;
|
||||
thread->resort_windows();
|
||||
}
|
||||
|
||||
_windows.sort();
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ private:
|
||||
void *_data;
|
||||
};
|
||||
|
||||
typedef ov_multiset< PT(GraphicsOutput), IndirectLess<GraphicsOutput> > Windows;
|
||||
typedef ov_set< PT(GraphicsOutput), IndirectLess<GraphicsOutput> > Windows;
|
||||
typedef pset< PT(GraphicsStateGuardian) > GSGs;
|
||||
typedef pset< Callback > Callbacks;
|
||||
|
||||
|
@ -264,7 +264,10 @@ needs_context() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool GraphicsOutput::
|
||||
operator < (const GraphicsOutput &other) const {
|
||||
return _sort < other._sort;
|
||||
if (_sort != other._sort) {
|
||||
return _sort < other._sort;
|
||||
}
|
||||
return this < &other;
|
||||
}
|
||||
|
||||
|
||||
|
@ -373,7 +373,8 @@ make_texture_buffer(const string &name, int x_size, int y_size) {
|
||||
}
|
||||
|
||||
// No good; delete the buffer and keep trying.
|
||||
engine->remove_window(buffer);
|
||||
bool removed = engine->remove_window(buffer);
|
||||
nassertr(removed, NULL);
|
||||
buffer = (GraphicsOutput *)NULL;
|
||||
}
|
||||
}
|
||||
@ -390,7 +391,8 @@ make_texture_buffer(const string &name, int x_size, int y_size) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
engine->remove_window(buffer);
|
||||
bool removed = engine->remove_window(buffer);
|
||||
nassertr(removed, NULL);
|
||||
buffer = (GraphicsOutput *)NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user