Closed Bug 351609 Opened 14 years ago Closed 14 years ago
_Unload Library always calls NSUn Link Module on lib->dlh on Mac OS X .
On Mac OS X, PRLibrary has several fields: CFragConnectionID connection; CFBundleRef bundle; CFMutableDictionaryRef wrappers; const struct mach_header* image; NSModule dlh; because we support loading several kinds of shared libraries. Only one of these fields is non-NULL. In PR_UnloadLibrary, we always call NSUnLinkModule on lib->dlh: result = NSUnLinkModule(lib->dlh, NSUNLINKMODULE_OPTION_NONE) ? 0 : -1; probably because lib->dlh is the first supported or "primary" kind of shared library. If lib->dlh is NULL, this call causes 'result' to be set to -1, and eventually causes PR_UnloadLibrary to fail, even though the right kind of shared library (lib->connection, lib->bundle, lib->wrappers, or lib->image) is successfully unloaded.
The fix is to test lib->dlh for non-NULL, just like we test lib->connection, lib->bundle, and lib->wrappers for non-NULL later in the PR_UnloadLibrary function.
Attachment #237026 - Flags: review?(mark)
Comment on attachment 237026 [details] [diff] [review] Proposed patch Looks good. The description in comment 0 is slightly misleading, but the patch is fine. (When you say "only one of these fields is non-NULL," it's not quite true: wrappers and connection are set together. Also, lib->image cannot be unloaded.)
Attachment #237026 - Flags: review?(mark) → review+
You're right, Mark. Thanks for the code review. I checked in the patch on the NSPR trunk (NSPR 4.7) and the NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.9 alpha). Checking in prlink.c; /cvsroot/mozilla/nsprpub/pr/src/linking/prlink.c,v <-- prlink.c new revision: 3.92; previous revision: 3.91 done Checking in prlink.c; /cvsroot/mozilla/nsprpub/pr/src/linking/prlink.c,v <-- prlink.c new revision: 220.127.116.11; previous revision: 18.104.22.168 done
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.7
I checked in the patch on the NSPR_4_6_BRANCH (NSPR 4.6.4). Checking in prlink.c; /cvsroot/mozilla/nsprpub/pr/src/linking/prlink.c,v <-- prlink.c new revision: 22.214.171.124; previous revision: 126.96.36.199 done
Target Milestone: 4.7 → 4.6.4
You need to log in before you can comment on or make changes to this bug.