mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -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;
|
size_t count;
|
||||||
{
|
{
|
||||||
MutexHolder holder(_lock);
|
MutexHolder holder(_lock);
|
||||||
|
if (!_windows_sorted) {
|
||||||
|
do_resort_windows();
|
||||||
|
}
|
||||||
count = _windows.erase(ptwin);
|
count = _windows.erase(ptwin);
|
||||||
}
|
}
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
@ -367,6 +370,8 @@ remove_window(GraphicsOutput *window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_remove_window(window);
|
do_remove_window(window);
|
||||||
|
|
||||||
|
nassertr(count == 1, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1167,6 +1172,7 @@ do_resort_windows() {
|
|||||||
RenderThread *thread = (*ti).second;
|
RenderThread *thread = (*ti).second;
|
||||||
thread->resort_windows();
|
thread->resort_windows();
|
||||||
}
|
}
|
||||||
|
|
||||||
_windows.sort();
|
_windows.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ private:
|
|||||||
void *_data;
|
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< PT(GraphicsStateGuardian) > GSGs;
|
||||||
typedef pset< Callback > Callbacks;
|
typedef pset< Callback > Callbacks;
|
||||||
|
|
||||||
|
@ -264,8 +264,11 @@ needs_context() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE bool GraphicsOutput::
|
INLINE bool GraphicsOutput::
|
||||||
operator < (const GraphicsOutput &other) const {
|
operator < (const GraphicsOutput &other) const {
|
||||||
|
if (_sort != other._sort) {
|
||||||
return _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.
|
// No good; delete the buffer and keep trying.
|
||||||
engine->remove_window(buffer);
|
bool removed = engine->remove_window(buffer);
|
||||||
|
nassertr(removed, NULL);
|
||||||
buffer = (GraphicsOutput *)NULL;
|
buffer = (GraphicsOutput *)NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,7 +391,8 @@ make_texture_buffer(const string &name, int x_size, int y_size) {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->remove_window(buffer);
|
bool removed = engine->remove_window(buffer);
|
||||||
|
nassertr(removed, NULL);
|
||||||
buffer = (GraphicsOutput *)NULL;
|
buffer = (GraphicsOutput *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user