1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 19:03:13 +02:00

Fix crash from loading exceptions with db_old and then unloading db_old

This commit is contained in:
Adam
2013-12-01 21:16:50 -05:00
parent faab2c6793
commit b5966cf99e
3 changed files with 12 additions and 5 deletions
+2
View File
@@ -32,6 +32,8 @@ class SessionService : public Service
SessionService(Module *m) : Service(m, "SessionService", "session") { }
virtual Exception *CreateException() = 0;
virtual void AddException(Exception *e) = 0;
virtual void DelException(Exception *e) = 0;
+5
View File
@@ -42,6 +42,11 @@ class MySessionService : public SessionService
public:
MySessionService(Module *m) : SessionService(m), Exceptions("Exception") { }
Exception *CreateException() anope_override
{
return new Exception();
}
void AddException(Exception *e) anope_override
{
this->Exceptions->push_back(e);
+5 -5
View File
@@ -1070,6 +1070,9 @@ static void LoadOper()
static void LoadExceptions()
{
if (!session_service)
return;
dbFILE *f = open_db_read("OperServ", "exception.db", 9);
if (f == NULL)
return;
@@ -1090,17 +1093,14 @@ static void LoadExceptions()
READ(read_int32(&time, f));
READ(read_int32(&expires, f));
Exception *exception = new Exception();
Exception *exception = session_service->CreateException();
exception->mask = mask;
exception->limit = limit;
exception->who = who;
exception->time = time;
exception->expires = expires;
exception->reason = reason;
if (session_service)
session_service->AddException(exception);
else
delete exception;
session_service->AddException(exception);
}
close_db(f);