Maybe fixed fonts collector crashing.

Originally committed to SVN as r1718.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-14 18:40:23 +00:00
parent 95492cec5e
commit e307f0578c
1 changed files with 1 additions and 17 deletions

View File

@ -365,9 +365,7 @@ void FontsCollectorThread::Collect() {
int oper = collector->CollectAction->GetSelection(); int oper = collector->CollectAction->GetSelection();
destFolder = collector->DestBox->GetValue(); destFolder = collector->DestBox->GetValue();
if (oper == 1 && !wxFileName::DirExists(destFolder)) { if (oper == 1 && !wxFileName::DirExists(destFolder)) {
wxMutexGuiEnter();
AppendText(_("Invalid destination directory."),1); AppendText(_("Invalid destination directory."),1);
wxMutexGuiLeave();
return; return;
} }
@ -380,14 +378,10 @@ void FontsCollectorThread::Collect() {
} }
// Collect font data // Collect font data
wxMutexGuiEnter();
AppendText(_("Collecting font data from system. This might take a while, depending on the number of fonts installed. Results are cached and subsequent executions will be faster...\n")); AppendText(_("Collecting font data from system. This might take a while, depending on the number of fonts installed. Results are cached and subsequent executions will be faster...\n"));
wxMutexGuiLeave();
CollectFontData(); CollectFontData();
wxMutexGuiEnter();
AppendText(_("Done collecting font data.")); AppendText(_("Done collecting font data."));
AppendText(_("Scanning file for fonts...")); AppendText(_("Scanning file for fonts..."));
wxMutexGuiLeave();
// Scan file // Scan file
if (collector->CollectAction->GetSelection() != 4) { if (collector->CollectAction->GetSelection() != 4) {
@ -420,7 +414,6 @@ void FontsCollectorThread::Collect() {
} }
// Copy fonts // Copy fonts
wxMutexGuiEnter();
AppendText(wxString(_("Done.")) + _T("\n\n")); AppendText(wxString(_("Done.")) + _T("\n\n"));
switch (oper) { switch (oper) {
case 0: AppendText(_("Checking fonts...\n")); break; case 0: AppendText(_("Checking fonts...\n")); break;
@ -428,7 +421,6 @@ void FontsCollectorThread::Collect() {
case 2: AppendText(_("Copying fonts to archive...\n")); break; case 2: AppendText(_("Copying fonts to archive...\n")); break;
case 3: AppendText(_("Attaching fonts to file...\n")); break; case 3: AppendText(_("Attaching fonts to file...\n")); break;
} }
wxMutexGuiLeave();
bool ok = true; bool ok = true;
bool someOk = false; bool someOk = false;
for (size_t i=0;i<fonts.Count();i++) { for (size_t i=0;i<fonts.Count();i++) {
@ -443,22 +435,16 @@ void FontsCollectorThread::Collect() {
delete zip; delete zip;
delete out; delete out;
wxMutexGuiEnter();
AppendText(wxString::Format(_("\nFinished writing to %s.\n"),destination.c_str()),1); AppendText(wxString::Format(_("\nFinished writing to %s.\n"),destination.c_str()),1);
wxMutexGuiLeave();
} }
// Final result // Final result
if (ok) { if (ok) {
if (oper == 0) { if (oper == 0) {
wxMutexGuiEnter();
AppendText(_("Done. All fonts found."),1); AppendText(_("Done. All fonts found."),1);
wxMutexGuiLeave();
} }
else { else {
wxMutexGuiEnter();
AppendText(_("Done. All fonts copied."),1); AppendText(_("Done. All fonts copied."),1);
wxMutexGuiLeave();
// Modify file if it was attaching // Modify file if it was attaching
if (oper == 3 && someOk) { if (oper == 3 && someOk) {
@ -470,10 +456,8 @@ void FontsCollectorThread::Collect() {
} }
} }
else { else {
wxMutexGuiEnter();
if (oper == 0) AppendText(_("Done. Some fonts could not be found."),2); if (oper == 0) AppendText(_("Done. Some fonts could not be found."),2);
else AppendText(_("Done. Some fonts could not be copied."),2); else AppendText(_("Done. Some fonts could not be copied."),2);
wxMutexGuiLeave();
} }
} }
@ -615,7 +599,7 @@ void FontsCollectorThread::AppendText(wxString text,int colour) {
} }
LogBox->GotoPos(pos); LogBox->GotoPos(pos);
LogBox->SetReadOnly(true); LogBox->SetReadOnly(true);
wxSafeYield(); //wxSafeYield();
wxMutexGuiLeave(); wxMutexGuiLeave();
} }