Skip to content

Commit 2766d12

Browse files
committed
Fixed Major issue of Crashing, when creating multiple PDFs in one instance
1 parent c63de0d commit 2766d12

File tree

10 files changed

+13
-18
lines changed

10 files changed

+13
-18
lines changed

Linux/.cache/0.png

237 KB
Loading

Linux/.cache/1.png

247 KB
Loading

Linux/.cache/src/main.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
main.o: src/main.cc src/lib/globals.hh src/lib/objects.hh \
2-
src/lib/fileParser.hh src/lib/imageGenerator.hh src/lib/pdfCreator.hh
1+
main.o: src/main.cc src/lib/globals.hh src/lib/objects.hh src/lib/gui.hh \
2+
src/lib/presentCreator.hh

Linux/.cache/src/main.o

-389 KB
Binary file not shown.

Linux/bitPresent

-138 KB
Binary file not shown.

Linux/src/gui.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,7 @@ void guiMain::OnCreateBtnClicked(wxCommandEvent &evt)
101101
Global::_INPATH = tmp;
102102

103103
createPresent((std::string) inputPathBox->GetValue(), (std::string) outputPathBox->GetValue());
104-
terminal->SetDefaultStyle(wxTextAttr(*wxGREEN));
105-
gprintf("You may now close this application\n");
106-
107-
inputPathBox->Enable(false);
108-
outputPathBox->Enable(false);
109-
inputBrowseBtn->Enable(false);
110-
outputBrowseBtn->Enable(false);
111-
createBtn->Enable(false);
104+
progressBar->SetValue(Global::_MAXPROGRESS);
112105
}
113106
evt.Skip();
114107
}

Linux/src/pdfCreator.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ int createPDF(std::string outpath)
3131
for(int i = 0; i < Global::_PRESENT[Global::_CPRESENT]->slides.size(); i++)
3232
{
3333
pages.push_back(HPDF_AddPage(pdf));
34+
if (pages[i] == nullptr)
35+
{
36+
gprintf("[ERROR]: Failed to create page for PDF\n");
37+
return -1;
38+
}
39+
3440
HPDF_Page_SetWidth(pages[i], Global::_WIDTH);
3541
HPDF_Page_SetHeight(pages[i], Global::_HEIGHT);
3642

Linux/src/presentCreator.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ int createPresent(std::string inpath, std::string outpath)
6262

6363
//Cleanup
6464
Global::_PRESENT[Global::_CPRESENT]->clean();
65+
Global::_CSLIDE = -1;
66+
Global::_CPOINT = -1;
6567

6668
gprintf("[FINISHED]: Done creating presentation\n");
6769
return 0;

Windows/gui.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,6 @@ void guiMain::OnCreateBtnClicked(wxCommandEvent& evt)
102102

103103
createPresent((std::string) inputPathBox->GetValue(), (std::string) outputPathBox->GetValue());
104104
progressBar->SetValue(Global::_MAXPROGRESS);
105-
terminal->SetDefaultStyle(wxTextAttr(*wxGREEN));
106-
gprintf("You may now close this application\n");
107-
108-
inputPathBox->Enable(false);
109-
outputPathBox->Enable(false);
110-
inputBrowseBtn->Enable(false);
111-
outputBrowseBtn->Enable(false);
112-
createBtn->Enable(false);
113105
}
114106
evt.Skip();
115107
}

Windows/presentCreator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ int createPresent(std::string inpath, std::string outpath)
6262

6363
//Cleanup
6464
Global::_PRESENT[Global::_CPRESENT]->clean();
65+
Global::_CSLIDE = -1;
66+
Global::_CPOINT = -1;
6567

6668
gprintf("[FINISHED]: Done creating presentation\n");
6769
return 0;

0 commit comments

Comments
 (0)