mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-06 06:58:15 +00:00
Add possibility to debug the UI garbage collection
This commit is contained in:
parent
eca3080d24
commit
0f150b249d
@ -10,6 +10,7 @@
|
|||||||
// #define DEBUG_PAINT_EVENTS
|
// #define DEBUG_PAINT_EVENTS
|
||||||
// #define LIMIT_DISPATCH_TIME
|
// #define LIMIT_DISPATCH_TIME
|
||||||
// #define DEBUG_UI_THREADS
|
// #define DEBUG_UI_THREADS
|
||||||
|
#define GARBAGE_TRACE(...)
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -351,6 +352,17 @@ void Manager::generateMessagesFromOSEvents()
|
|||||||
|
|
||||||
if (canWait && used_msg_queue.empty())
|
if (canWait && used_msg_queue.empty())
|
||||||
collectGarbage();
|
collectGarbage();
|
||||||
|
#if _DEBUG
|
||||||
|
else if (!m_garbage.empty()) {
|
||||||
|
GARBAGE_TRACE("collectGarbage() wasn't called #objects=%d"
|
||||||
|
" (msg_queue=%d used_msg_queue=%d redrawState=%d runningTimers=%d)\n",
|
||||||
|
int(m_garbage.size()),
|
||||||
|
msg_queue.size(),
|
||||||
|
used_msg_queue.size(),
|
||||||
|
int(redrawState),
|
||||||
|
Timer::haveRunningTimers());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_eventQueue->getEvent(sheEvent, canWait);
|
m_eventQueue->getEvent(sheEvent, canWait);
|
||||||
if (sheEvent.type() == os::Event::None)
|
if (sheEvent.type() == os::Event::None)
|
||||||
@ -1568,10 +1580,13 @@ void Manager::collectGarbage()
|
|||||||
if (m_garbage.empty())
|
if (m_garbage.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (WidgetsList::iterator
|
GARBAGE_TRACE("Manager::collectGarbage() #objects=%d\n", int(m_garbage.size()));
|
||||||
it = m_garbage.begin(),
|
|
||||||
end = m_garbage.end(); it != end; ++it) {
|
for (auto widget : m_garbage) {
|
||||||
delete *it;
|
GARBAGE_TRACE(" -> deleting %s %s ---\n",
|
||||||
|
typeid(*widget).name(),
|
||||||
|
widget->id().c_str());
|
||||||
|
delete widget;
|
||||||
}
|
}
|
||||||
m_garbage.clear();
|
m_garbage.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user