maniaplanet / manialive

PHP controller for the ManiaPlanet Dedicated Server
GNU Lesser General Public License v3.0
9 stars 4 forks source link

ManiaLive\libraries\ManiaLive\Gui\Windowing\Windowhandler.php #30

Closed magnetik closed 10 years ago

magnetik commented 10 years ago

From w1llaopgezwolle@gmail.com on May 21, 2011 10:19:25

I edited a file to show echo's to see if manialive really disables windows.

Files edited: Windowhandler.php

lines edited: 684-688.

Release 216 of manialive.

Open as a player 5 windows and minimize them right away. After all that is done disconnect from the server and the following will be shown.

[code]

Controls that have not been freed: PHP Fatal error: Access to undeclared static property: ManiaLive\Gui\Windowing\ Control::$controls in C:\tmn\ManiaLive\libraries\ManiaLive\Gui\Windowing\WindowH andler.php on line 685 PHP Stack trace: PHP 1. {main}() C:\tmn\ManiaLive\bootstrapper.php:0 PHP 2. ManiaLive\Application\AbstractApplication->run() C:\tmn\ManiaLive\boots trapper.php:82 PHP 3. ManiaLive\DedicatedApi\Connection->executeCallbacks() C:\tmn\ManiaLive\ libraries\ManiaLive\Application\AbstractApplication.php:146 PHP 4. ManiaLive\Event\Dispatcher::dispatch() C:\tmn\ManiaLive\libraries\Mania Live\DedicatedApi\Connection.php:108 PHP 5. ManiaLive\DedicatedApi\Callback\Event->fireDo() C:\tmn\ManiaLive\librar ies\ManiaLive\Event\Dispatcher.php:52 PHP 6. call_user_func_array() C:\tmn\ManiaLive\libraries\ManiaLive\DedicatedAp i\Callback\Event.php:28 PHP 7. ManiaLive\Gui\Windowing\WindowHandler->onPlayerDisconnect() C:\tmn\Mani aLive\libraries\ManiaLive\DedicatedApi\Callback\Event.php:0

Fatal error: Access to undeclared static property: ManiaLive\Gui\Windowing\Contr ol::$controls in C:\tmn\ManiaLive\libraries\ManiaLive\Gui\Windowing\WindowHandle r.php on line 685

Call Stack: 0.0005 352896 1. {main}() C:\tmn\ManiaLive\bootstrapper.php:0 0.0270 2113424 2. ManiaLive\Application\AbstractApplication->run() C:\t mn\ManiaLive\bootstrapper.php:82 47.9346 18586664 3. ManiaLive\DedicatedApi\Connection->executeCallbacks() C:\tmn\ManiaLive\libraries\ManiaLive\Application\AbstractApplication.php:146 47.9351 18587896 4. ManiaLive\Event\Dispatcher::dispatch() C:\tmn\ManiaLi ve\libraries\ManiaLive\DedicatedApi\Connection.php:108 47.9352 18588176 5. ManiaLive\DedicatedApi\Callback\Event->fireDo() C:\tm n\ManiaLive\libraries\ManiaLive\Event\Dispatcher.php:52 47.9352 18588488 6. call_user_func_array() C:\tmn\ManiaLive\libraries\Man iaLive\DedicatedApi\Callback\Event.php:28 47.9352 18588672 7. ManiaLive\Gui\Windowing\WindowHandler->onPlayerDiscon nect() C:\tmn\ManiaLive\libraries\ManiaLive\DedicatedApi\Callback\Event.php:0

[/code]

This happens if a player opens up 5 windows and then leaves.

When editing an other line it will show that its being removed but its not being freed from memory.

Original issue: http://code.google.com/p/manialive/issues/detail?id=30

magnetik commented 10 years ago

From melot.philippe on May 23, 2011 02:51:29

Can you tell me which version of ManiaLive you are running ? And can you tell me which method is sending this message ?

magnetik commented 10 years ago

From w1llaopgezwolle@gmail.com on May 24, 2011 06:08:46

The version i run is 216 of manialive.

This is the total function of what i edited.

/* * (non-PHPdoc) * @see libraries/ManiaLive/DedicatedApi/Callback/ManiaLive\DedicatedApi\Callback.Listener::onPlayerDisconnect() / function onPlayerDisconnect($login) { // clear drawStack for that player unset(self::$drawStack[$login]);

    // free the dialog
    self::$dialogStack = array();

    // free managed windows ...
    unset(self::$currentManagedWindow[$login]);
    unset(self::$minimizedManagedWindowHashes[$login]);
    unset(self::$minimizedManagedWindows[$login]);

    // clean memory ...
    self::destroyPlayerWindows($login);
    gc_collect_cycles();

    //echo "Controls that have not been freed:\n";
    //foreach (Control::$controls as $control)
    //{
    //  echo "- " . $control . "\n";
    //}
}

/**
 * Removes all window resources that have been allocated
 * for the player.
 * @param string $login Players Login
 */
static function destroyPlayerWindows($login)
{
    echo "\nremoving player windows!\n";

    if (isset(Window::$instances[$login]))
    {
        foreach (Window::$instances[$login] as $window)
        {
            $window->destroy();
        }
        unset(Window::$instances[$login]);
    }

    if (isset(Window::$instancesNonSingleton[$login]))
    {
        foreach (Window::$instancesNonSingleton[$login] as $window)
        {
            $window->destroy();
        }
        unset(Window::$instancesNonSingleton[$login]);
    }
}
magnetik commented 10 years ago

From melot.philippe on May 25, 2011 07:24:09

What have you done to be sure that some instances are still present in memory after having been released from the WindowHandler ?

magnetik commented 10 years ago

From w1llaopgezwolle@gmail.com on May 25, 2011 09:24:12

The following was loaded and gives me this...

This happened after leaving the server.

< unloading ManiaLive\Gui\Windowing\Windows\Shortkey < unloading ManiaLivePlugins\MLEPP\AdminPanel\Gui\Windows\AdminPanelWindow < unloading ManiaLivePlugins\MLEPP\ChallengeWidget\Gui\Windows\ChallengeWidgetWi ndow < unloading ManiaLivePlugins\MLEPP\DonateCoppers\Gui\DonatePanel < unloading ManiaLivePlugins\MLEPP\Karma\Gui\Windows\KarmaWindow < unloading ManiaLivePlugins\Flo\TMKarma\Gui\Windows\Widget < unloading ManiaLivePlugins\MLEPP\TmxInfo\Gui\Windows\SimpleWindow < unloading ManiaLivePlugins\MLEPP\AdminPanel\Gui\Windows\AdminWindow < unloading ManiaLivePlugins\MLEPP\Jukebox\Gui\Windows\trackList < unloading ManiaLivePlugins\MLEPP\ChatLog\Gui\Windows\ChatLogWindow < unloading ManiaLivePlugins\MLEPP\Core\Gui\Windows\helpWindow << desctructing ManiaLive\Gui\Windowing\Windows\Shortkey << desctructing ManiaLivePlugins\MLEPP\AdminPanel\Gui\Windows\AdminPanelWindow << desctructing ManiaLivePlugins\MLEPP\ChallengeWidget\Gui\Windows\ChallengeWidg etWindow << desctructing ManiaLivePlugins\MLEPP\Karma\Gui\Windows\KarmaWindow << desctructing ManiaLivePlugins\Flo\TMKarma\Gui\Windows\Widget < unloading ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLivePlugins\MLEPP\TmxInfo\Gui\Windows\SimpleWindow < unloading ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLivePlugins\MLEPP\AdminPanel\Gui\Windows\AdminWindow < unloading ManiaLive\Gui\Windowing\Windows\Thumbnail < unloading ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLivePlugins\MLEPP\ChatLog\Gui\Windows\ChatLogWindow < unloading ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLivePlugins\MLEPP\Core\Gui\Windows\helpWindow << desctructing ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLive\Gui\Windowing\Windows\Thumbnail << desctructing ManiaLivePlugins\MLEPP\Jukebox\Gui\Windows\trackList [18:23:24] [MLEPP] [JoinLeaveMessage] dccw1lla left the server.

magnetik commented 10 years ago

From melot.philippe on December 31, 2012 01:33:04

Status: Done