Skip to content

Commit

Permalink
Destroy library before deleting g_font_info in ShutdownSDK()
Browse files Browse the repository at this point in the history
FPDF_DestroyLibrary() will eventually call Release on the default
sysfontinfo. Also, should not try to delete this from the metrics
sysfontinfo, as that is what is done in FPDF_FreeDefault...()

BUG=664072

Review-Url: https://codereview.chromium.org/2493603003
Cr-Commit-Position: refs/heads/master@{#431319}
  • Loading branch information
npm1 authored and Commit bot committed Nov 10, 2016
1 parent 23ce0ee commit d7e4f1d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pdf/pdfium/pdfium_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ struct FPDF_SYSFONTINFO_WITHMETRICS : public FPDF_SYSFONTINFO {
default_sysfontinfo = sysfontinfo;
}

~FPDF_SYSFONTINFO_WITHMETRICS() { delete default_sysfontinfo; }
~FPDF_SYSFONTINFO_WITHMETRICS() {
FPDF_FreeDefaultSystemFontInfo(default_sysfontinfo);
}

FPDF_SYSFONTINFO* default_sysfontinfo;
};
Expand Down Expand Up @@ -651,11 +653,10 @@ bool InitializeSDK() {
}

void ShutdownSDK() {
FPDF_DestroyLibrary();
#if !defined(OS_LINUX)
FPDF_FreeDefaultSystemFontInfo(g_font_info->default_sysfontinfo);
delete g_font_info;
#endif
FPDF_DestroyLibrary();
TearDownV8();
}

Expand Down

0 comments on commit d7e4f1d

Please sign in to comment.