1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

Use HashMap::remove() in some places that I wanted it.

This commit is contained in:
Andreas Kling 2018-10-13 14:26:37 +02:00
parent 969334505d
commit 6ea8ce500c
5 changed files with 10 additions and 5 deletions

View file

@ -18,8 +18,7 @@ FileSystem::FileSystem()
FileSystem::~FileSystem() FileSystem::~FileSystem()
{ {
// FIXME: Needs HashMap::remove()! fileSystems().remove(m_id);
//fileSystems().remove(m_id);
} }
FileSystem* FileSystem::fromID(dword id) FileSystem* FileSystem::fromID(dword id)

View file

@ -115,11 +115,10 @@ void VirtualFileSystem::freeNode(Node* node)
{ {
ASSERT(node); ASSERT(node);
ASSERT(node->inUse()); ASSERT(node->inUse());
m_inode2vnode.remove(node->inode);
node->inode.fileSystem()->release(); node->inode.fileSystem()->release();
node->inode = InodeIdentifier(); node->inode = InodeIdentifier();
m_nodeFreeList.append(std::move(node)); m_nodeFreeList.append(std::move(node));
// FIXME: Need HashMap::remove.
//m_inode2vnode.remove(node);
} }
bool VirtualFileSystem::isDirectory(const String& path) bool VirtualFileSystem::isDirectory(const String& path)

View file

@ -11,6 +11,7 @@ Window::Window(Object* parent)
Window::~Window() Window::~Window()
{ {
WindowManager::the().removeWindow(*this);
} }
void Window::setMainWidget(Widget* widget) void Window::setMainWidget(Widget* widget)
@ -31,7 +32,6 @@ void Window::setTitle(String&& title)
WindowManager::the().notifyTitleChanged(*this); WindowManager::the().notifyTitleChanged(*this);
} }
void Window::setRect(const Rect& rect) void Window::setRect(const Rect& rect)
{ {
if (m_rect == rect) if (m_rect == rect)

View file

@ -118,6 +118,12 @@ void WindowManager::addWindow(Window& window)
m_windows.set(&window); m_windows.set(&window);
} }
void WindowManager::removeWindow(Window& window)
{
ASSERT(m_windows.contains(&window));
m_windows.remove(&window);
}
void WindowManager::notifyTitleChanged(Window& window) void WindowManager::notifyTitleChanged(Window& window)
{ {
//printf("[WM] Window{%p} title set to '%s'\n", &window, window.title().characters()); //printf("[WM] Window{%p} title set to '%s'\n", &window, window.title().characters());

View file

@ -14,6 +14,7 @@ class WindowManager : public Object {
public: public:
static WindowManager& the(); static WindowManager& the();
void addWindow(Window&); void addWindow(Window&);
void removeWindow(Window&);
void paintWindowFrames(); void paintWindowFrames();
void notifyTitleChanged(Window&); void notifyTitleChanged(Window&);