fixed: plugin ticket: when a session expires all files from editticket were removed
it should be removed only those new added git-svn-id: svn://ttmath.org/publicrep/winix/trunk@798 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -66,9 +66,7 @@ void PluginData::DeleteAll()
|
||||
return;
|
||||
|
||||
plugin.Call(WINIX_SESSION_REMOVE);
|
||||
|
||||
for(size_t i=0 ; i<table.size() ; ++i)
|
||||
table[i] = 0;
|
||||
table.clear();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -19,6 +19,13 @@
|
||||
struct PluginDataBase
|
||||
{
|
||||
virtual ~PluginDataBase() {}
|
||||
|
||||
/*
|
||||
when deleting sessions we first call Clear() method
|
||||
consequently the destructor has nothing to do
|
||||
(and it doesn not throw an exception)
|
||||
*/
|
||||
virtual void Clear() {}
|
||||
};
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -47,6 +47,7 @@
|
||||
#define WINIX_SESSION_CREATED 3000
|
||||
|
||||
// here you should remove your session data
|
||||
// this message can be sent even if you don't assing your plugin data
|
||||
#define WINIX_SESSION_REMOVE 3001
|
||||
|
||||
// when a session is changed (you can save a pointer to your data here)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -50,6 +50,7 @@ Table::iterator i = table.begin();
|
||||
while( i != table.end() )
|
||||
{
|
||||
cur->session = &(*i);
|
||||
cur->session->plugin_data.DeleteAll(); // it's better to call it here instead of the destructor
|
||||
table.erase(i++);
|
||||
}
|
||||
|
||||
@@ -71,6 +72,10 @@ void SessionContainer::EraseById(IdIterator i)
|
||||
cur->session = &(*i->second);
|
||||
|
||||
log << log4 << "SC: deleting session, id: " << i->second->id << logend;
|
||||
|
||||
// call first DeleteAll() because if not then it would be called from the desctructor
|
||||
// and there'll be a problem if it throws an exception there
|
||||
i->second->plugin_data.DeleteAll();
|
||||
table.erase(i->second);
|
||||
index_id.erase(i);
|
||||
table_size -= 1;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ class SessionContainer
|
||||
{
|
||||
public:
|
||||
|
||||
// when deleting Sessions you should set request.session into the session object
|
||||
// when deleting Sessions you should set cur->session into the session object
|
||||
// this allows to delete plugins session data
|
||||
// because a session object has plugin_data object
|
||||
// and in its destructor the plugin.Call(WINIX_SESSION_REMOVE) is called
|
||||
|
Reference in New Issue
Block a user