[ros-diffs] [mf] 20391: correct command line handling in lean explorer

mf at svn.reactos.com mf at svn.reactos.com
Wed Dec 28 13:27:29 CET 2005


correct command line handling in lean explorer
Modified:
branches/lean-explorer/reactos/subsys/system/explorer/explorer.cpp
  _____  

Modified:
branches/lean-explorer/reactos/subsys/system/explorer/explorer.cpp
--- branches/lean-explorer/reactos/subsys/system/explorer/explorer.cpp
2005-12-28 02:20:27 UTC (rev 20390)
+++ branches/lean-explorer/reactos/subsys/system/explorer/explorer.cpp
2005-12-28 12:27:25 UTC (rev 20391)
@@ -452,10 +452,14 @@

 			cmd.ParseCmdLine(lpCmdLine);
 
 		 // Open the first child window after initializing the
application
-		if (cmd.IsValidPath())
-			PostMessage(hMainFrame, PM_OPEN_WINDOW,
cmd._flags, (LPARAM)lpCmdLine);
-		else
-			PostMessage(hMainFrame, PM_OPEN_WINDOW,
0/*OWM_EXPLORE|OWM_DETAILS*/, 0);
+		if (cmd.IsValidPath()) {
+			 // We use the static s_path variable to store
the path string in order 
+			 // to avoid accessing prematurely freed memory
in the PostMessage handlers.
+			static String s_path = cmd._path;
+
+			PostMessage(hMainFrame, PM_OPEN_WINDOW,
cmd._flags, (LPARAM)(LPCTSTR)s_path);
+		} else
+			PostMessage(hMainFrame, PM_OPEN_WINDOW,
cmd._flags, 0);
 	}
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051228/c429f392/attachment.html


More information about the Ros-diffs mailing list