Patch #952 2006-03-24 10:25

thenullinator

Project opened twice when passed in command line
Download
952-Project_opened.patch (463 bytes)
Category
Application::Bugfix
Status
Closed
Close date
2006-03-25 11:55
Assigned to
 
Index: src/sdk/projectmanager.cpp
===================================================================
--- src/sdk/projectmanager.cpp    (revision 2244)
+++ src/sdk/projectmanager.cpp    (working copy)
@@ -631,6 +631,10 @@
 cbProject* ProjectManager::LoadProject(const wxString& filename, bool activateIt)
 {
     SANITY_CHECK(0L);
+
+    if (m_IsLoadingProject)
+        return 0L;
+
     cbProject* result = 0;
 
     // disallow application shutdown while opening files
thenullinator 2006-03-24 13:18

Hmm, that only fixes it when a project file is opened from Windows Explorer. I just tested it from the Command Prompt and it doesn't work (no project opened). I thought it was odd for the fix to be "count - 1". It just didn't seem right (although it worked).

I checked the association for .cbp in RegEdit, it is "G:\CodeBlocks\src\output\codeblocks.exe" "%1". Nothing wrong there.

thenullinator 2006-03-24 14:21

I've updated the patch. It works from both the Command Prompt and Windows Explorer now. It seems Windows Explorer was sending a DDE message in addition to sending the filename on the command line.

This was only noticeable with v1.3 projects as Code::Blocks informs you about updating the project file twice. Because of the dialog the DDE and command line calls to ProjectManager::LoadProject became synchronized at the dialog and the safeguard ProjectManager::IsOpen didn't work because neither project had finished loading. Thus the reason why v1.3 projects loaded twice in Management -> Projects as opposed to v1.4 projects.

killerbot 2006-03-25 11:55

applied,

many thanks.