summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-07-08 20:14:44 -0300
committershennetsind <ind@henn.et>2013-07-08 20:14:44 -0300
commita2eacedd5df4a0bea47a15fa3a7f92e36f901b9f (patch)
treea95537a82de3422bd5c4f5e9bae0846d22f93b1f /src/map/script.c
parent606a98573346c984dc36be3b2db67fb9f0da1d03 (diff)
downloadhercules-a2eacedd5df4a0bea47a15fa3a7f92e36f901b9f.tar.gz
hercules-a2eacedd5df4a0bea47a15fa3a7f92e36f901b9f.tar.bz2
hercules-a2eacedd5df4a0bea47a15fa3a7f92e36f901b9f.tar.xz
hercules-a2eacedd5df4a0bea47a15fa3a7f92e36f901b9f.zip
Fixed Bug #7485
Special Thanks to Igniz http://hercules.ws/board/tracker/issue-7485-crash-on-reloadscript/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 19e6457bd..aef636d0e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3761,11 +3761,6 @@ void do_final_script(void) {
}
#endif
- mapreg_final();
-
- userfunc_db->destroy(userfunc_db, db_script_free_code_sub);
- autobonus_db->destroy(autobonus_db, db_script_free_code_sub);
-
iter = db_iterator(script->st_db);
for( st = dbi_first(iter); dbi_exists(iter); st = dbi_next(iter) ) {
@@ -3774,6 +3769,11 @@ void do_final_script(void) {
dbi_destroy(iter);
+ mapreg_final();
+
+ userfunc_db->destroy(userfunc_db, db_script_free_code_sub);
+ autobonus_db->destroy(autobonus_db, db_script_free_code_sub);
+
if (script->str_data)
aFree(script->str_data);
if (script->str_buf)
@@ -3846,6 +3846,14 @@ int script_reload() {
DBIterator *iter;
struct script_state *st;
+ iter = db_iterator(script->st_db);
+
+ for( st = dbi_first(iter); dbi_exists(iter); st = dbi_next(iter) ) {
+ script_free_state(st);
+ }
+
+ dbi_destroy(iter);
+
userfunc_db->clear(userfunc_db, db_script_free_code_sub);
script->label_count = 0;
@@ -3857,14 +3865,6 @@ int script_reload() {
aFree(atcommand->binding);
atcommand->binding_count = 0;
-
- iter = db_iterator(script->st_db);
-
- for( st = dbi_first(iter); dbi_exists(iter); st = dbi_next(iter) ) {
- script_free_state(st);
- }
-
- dbi_destroy(iter);
db_clear(script->st_db);