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();
destFolder = collector->DestBox->GetValue();
if (oper == 1 && !wxFileName::DirExists(destFolder)) {
wxMutexGuiEnter();
AppendText(_("Invalid destination directory."),1);
wxMutexGuiLeave();
return;
}
@ -380,14 +378,10 @@ void FontsCollectorThread::Collect() {
}
// 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"));
wxMutexGuiLeave();
CollectFontData();
wxMutexGuiEnter();
AppendText(_("Done collecting font data."));
AppendText(_("Scanning file for fonts..."));
wxMutexGuiLeave();
// Scan file
if (collector->CollectAction->GetSelection() != 4) {
@ -420,7 +414,6 @@ void FontsCollectorThread::Collect() {
}
// Copy fonts
wxMutexGuiEnter();
AppendText(wxString(_("Done.")) + _T("\n\n"));
switch (oper) {
case 0: AppendText(_("Checking fonts...\n")); break;
@ -428,7 +421,6 @@ void FontsCollectorThread::Collect() {
case 2: AppendText(_("Copying fonts to archive...\n")); break;
case 3: AppendText(_("Attaching fonts to file...\n")); break;
}
wxMutexGuiLeave();
bool ok = true;
bool someOk = false;
for (size_t i=0;i<fonts.Count();i++) {
@ -443,22 +435,16 @@ void FontsCollectorThread::Collect() {
delete zip;
delete out;
wxMutexGuiEnter();
AppendText(wxString::Format(_("\nFinished writing to %s.\n"),destination.c_str()),1);
wxMutexGuiLeave();
}
// Final result
if (ok) {
if (oper == 0) {
wxMutexGuiEnter();
AppendText(_("Done. All fonts found."),1);
wxMutexGuiLeave();
}
else {
wxMutexGuiEnter();
AppendText(_("Done. All fonts copied."),1);
wxMutexGuiLeave();
// Modify file if it was attaching
if (oper == 3 && someOk) {
@ -470,10 +456,8 @@ void FontsCollectorThread::Collect() {
}
}
else {
wxMutexGuiEnter();
if (oper == 0) AppendText(_("Done. Some fonts could not be found."),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->SetReadOnly(true);
wxSafeYield();
//wxSafeYield();
wxMutexGuiLeave();
}