Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Crash with batch build on linux
BlueHazzard:
--- Code: ---diff --git a/src/src/app.cpp b/src/src/app.cpp
index 22a46dfb1..8b90cae68 100644
--- a/src/src/app.cpp
+++ b/src/src/app.cpp
@@ -749,8 +749,15 @@ bool CodeBlocksApp::OnInit()
s_Loading = false;
LoadDelayedFiles(frame);
- BatchJob();
- frame->Close();
+ m_startBatchBuild.Bind(wxEVT_TIMER, [this](wxTimerEvent& evt)
+ {
+ this->BatchJob();
+ });
+
+ m_startBatchBuild.Start(2000, true);
+
+
+ //frame->Close();
return true;
}
@@ -974,6 +981,10 @@ int CodeBlocksApp::BatchJob()
wxString bb_title = m_pBatchBuildDialog->GetTitle();
m_pBatchBuildDialog->SetTitle(bb_title + _T(" - ") + title);
m_pBatchBuildDialog->Show();
+ m_pBatchBuildDialog->Bind(wxEVT_CLOSE_WINDOW, [=](wxCloseEvent& evt)
+ {
+ m_Frame->Close();
+ });
if (m_ReBuild)
{
@@ -1000,7 +1011,7 @@ int CodeBlocksApp::BatchJob()
// The batch build log might have been deleted in
diff --git a/src/src/app.cpp b/src/src/app.cpp
index 22a46dfb1..8b90cae68 100644
--- a/src/src/app.cpp
+++ b/src/src/app.cpp
@@ -749,8 +749,15 @@ bool CodeBlocksApp::OnInit()
s_Loading = false;
LoadDelayedFiles(frame);
- BatchJob();
- frame->Close();
+ m_startBatchBuild.Bind(wxEVT_TIMER, [this](wxTimerEvent& evt)
+ {
+ this->BatchJob();
+ });
+
+ m_startBatchBuild.Start(2000, true);
+
+
+ //frame->Close();
return true;
}
@@ -974,6 +981,10 @@ int CodeBlocksApp::BatchJob()
wxString bb_title = m_pBatchBuildDialog->GetTitle();
m_pBatchBuildDialog->SetTitle(bb_title + _T(" - ") + title);
m_pBatchBuildDialog->Show();
+ m_pBatchBuildDialog->Bind(wxEVT_CLOSE_WINDOW, [=](wxCloseEvent& evt)
+ {
+ m_Frame->Close();
+ });
if (m_ReBuild)
{
@@ -1000,7 +1011,7 @@ int CodeBlocksApp::BatchJob()
// The batch build log might have been deleted in
diff --git a/src/src/app.cpp b/src/src/app.cpp
index 22a46dfb1..8b90cae68 100644
--- a/src/src/app.cpp
+++ b/src/src/app.cpp
@@ -749,8 +749,15 @@ bool CodeBlocksApp::OnInit()
s_Loading = false;
LoadDelayedFiles(frame);
- BatchJob();
- frame->Close();
+ m_startBatchBuild.Bind(wxEVT_TIMER, [this](wxTimerEvent& evt)
+ {
+ this->BatchJob();
+ });
+
+ m_startBatchBuild.Start(2000, true);
+
+
+ //frame->Close();
return true;
}
@@ -974,6 +981,10 @@ int CodeBlocksApp::BatchJob()
wxString bb_title = m_pBatchBuildDialog->GetTitle();
m_pBatchBuildDialog->SetTitle(bb_title + _T(" - ") + title);
m_pBatchBuildDialog->Show();
+ m_pBatchBuildDialog->Bind(wxEVT_CLOSE_WINDOW, [=](wxCloseEvent& evt)
+ {
+ m_Frame->Close();
+ });
if (m_ReBuild)
{
@@ -1000,7 +1011,7 @@ int CodeBlocksApp::BatchJob()
// The batch build log might have been deleted in
// CodeBlocksApp::OnBatchBuildDone().
// If it has not, it's still compiling.
- if (m_pBatchBuildDialog)
+ /*if (m_pBatchBuildDialog)
{
// If operation is "--clean", there is no need to display the dialog
// as the operation is synchronous and it already has finished by the
@@ -1015,7 +1026,7 @@ int CodeBlocksApp::BatchJob()
m_pBatchBuildDialog->Destroy();
m_pBatchBuildDialog = nullptr;
}
- }
+ }*/
if (tbIcon)
{
@@ -1053,13 +1064,16 @@ void CodeBlocksApp::OnBatchBuildDone(CodeBlocksEvent& event)
if (m_pBatchBuildDialog && m_BatchWindowAutoClose)
{
- if (m_pBatchBuildDialog->IsModal())
+ /*if (m_pBatchBuildDialog->IsModal())
m_pBatchBuildDialog->EndModal(wxID_OK);
else
{
- m_pBatchBuildDialog->Destroy();
- m_pBatchBuildDialog = nullptr;
- }
+
+
+ }*/
+ m_pBatchBuildDialog->Close();
+ //m_pBatchBuildDialog->Destroy();
+ //m_pBatchBuildDialog = nullptr;
}
}
diff --git a/src/src/app.h b/src/src/app.h
index 97c69e74e..953916fba 100644
--- a/src/src/app.h
+++ b/src/src/app.h
@@ -142,6 +142,8 @@ class CodeBlocksApp : public wxApp
void SetupPersonality(const wxString& personality);
void SetupImageSizes(wxToolBarAddOnXmlHandler *toolbarAddonHandler);
+ wxTimer m_startBatchBuild;
+
wxString m_Prefix; // directory specified in --prefix switch
wxString m_UserDataDir; // directory specified in --user-data-dir switch
--- End code ---
still quick patch. I am still testing.... time is limited... and testing is difficult and slow...
[edit:] first problem found: can not cancel building withtout crash
BlueHazzard:
This is really a shit situation...
I am close to throw the log manager out from the compiler
1) Is there some way to know when the build is completely finished? Not just project or file, but workspace? (If not, why do we do not have an event for this?)
2) Is there a way to wait until the event queue is completely empty?
3) Is there a way to put an event at the end of the event loop?
sodev:
--- Quote from: BlueHazzard on August 05, 2019, 11:43:33 pm ---1) Is there some way to know when the build is completely finished? Not just project or file, but workspace? (If not, why do we do not have an event for this?)
--- End quote ---
Not my business 8)
--- Quote ---2) Is there a way to wait until the event queue is completely empty?
--- End quote ---
Sort of, wxWidgets will create an Idle-Event whenever the main event loop runs empty, however that doesn't mean that there won't be any new events beeing queued. Only way to know that wxWidgets is about to end is when the OnExit() method of the App object is called. This however requires that wxWidgets will be stopped which usually does not happen if there is a wxFrame open.
--- Quote ---3) Is there a way to put an event at the end of the event loop?
--- End quote ---
You can use QueueEvent() or CallAfter() but this will queue the event at the end of the wxEvtHandler you called these methods on, there may be other event handlers active that will be called later, hence these events are only locally at the end, not globally. Plus i am not sure which of these do work in wx 2.8.
BlueHazzard:
Thank you for the help. So wxWidgets does not supports me in this..
oBFusCATed:
Why do you want to do 2 and 3 in the first place?
As far as I know events aren't reordered, so you can put an event in the queue and when it is executed you would know that it is the last one or at least you've reached something like a barrier.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version