aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-06-27 12:55:56 +0200
committerDan Gudmundsson <[email protected]>2011-09-21 12:45:53 +0200
commit51b66111af55e26710d5e8e0a8c3f98c38bd7207 (patch)
tree5420c623843acc770871451fc8c1436d9a5e51ed /lib
parent7b6012a75f26219e5a8c803a0509d97d1b00c73a (diff)
downloadotp-51b66111af55e26710d5e8e0a8c3f98c38bd7207.tar.gz
otp-51b66111af55e26710d5e8e0a8c3f98c38bd7207.tar.bz2
otp-51b66111af55e26710d5e8e0a8c3f98c38bd7207.zip
[wx] Fix cleanup memory references
Could cause a crash in later restarts
Diffstat (limited to 'lib')
-rw-r--r--lib/wx/c_src/wxe_impl.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index 95755978f1..70d4c4b29e 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -588,7 +588,7 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
} else {
delete_object(ptr, refd);
}
- if(type == 0 || type > 3) {
+ if(type == 0 || type > 2) {
// Delete refs for leaks and non overridden allocs
delete refd;
ptr2ref.erase(it);
@@ -602,13 +602,13 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
}
}
}
- // Assert ?
-// for(ptrMap::iterator it = ptr2ref.begin(); it != ptr2ref.end(); it++) {
-// wxeRefData *refd = it->second;
-// if(refd->ref >= global_me->next)
-// fprintf(stderr, "L %d %d\r\n", refd->ref, refd->alloc_in_erl);
-// }
-// fflush(stderr);
+// // Assert ?
+// for(ptrMap::iterator it = ptr2ref.begin(); it != ptr2ref.end(); it++) {
+// wxeRefData *refd = it->second;
+// if(refd->ref >= global_me->next)
+// fprintf(stderr, "L %d %d %d\r\n", refd->ref, refd->type, refd->alloc_in_erl);
+// }
+// fflush(stderr);
delete memenv;
driver_pdl_dec_refc(Ecmd.pdl);
refmap.erase((ErlDrvTermData) Ecmd.port);
@@ -650,12 +650,12 @@ int WxeApp::getRef(void * ptr, wxeMemEnv *memenv) {
ptrMap::iterator it = ptr2ref.find(ptr);
if(it != ptr2ref.end()) {
wxeRefData *refd = it->second;
- if(refd->memenv == memenv) {
+ if(refd->memenv == memenv || refd->memenv == global_me) {
// Found it return
return refd->ref;
} // else
// Old reference to deleted object, release old and recreate in current memenv.
- clearPtr(ptr);
+ ptr2ref.erase(it);
}
int ref;
intList free = memenv->free;