SF.net SVN: geany: [2343] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Fri Mar 14 16:19:54 UTC 2008
Revision: 2343
http://geany.svn.sourceforge.net/geany/?rev=2343&view=rev
Author: eht16
Date: 2008-03-14 09:19:53 -0700 (Fri, 14 Mar 2008)
Log Message:
-----------
Fix crashes on Windows when error argument of utils_spawn_* is NULL.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/win32.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-03-14 13:11:46 UTC (rev 2342)
+++ trunk/ChangeLog 2008-03-14 16:19:53 UTC (rev 2343)
@@ -7,6 +7,8 @@
2008-03-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/Makefile.am: Add prefs.h to the list of installed header files.
+ * src/win32.c: Fix crashes on Windows when error argument of
+ utils_spawn_* is NULL.
2008-03-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c 2008-03-14 13:11:46 UTC (rev 2342)
+++ trunk/src/win32.c 2008-03-14 16:19:53 UTC (rev 2343)
@@ -787,7 +787,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("win32_spawn: Second CreateFile failed (%d)", (gint) GetLastError());
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
g_free(msg);
return FALSE;
}
@@ -800,7 +801,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("win32_spawn: Second CreateFile failed (%d)", (gint) GetLastError());
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
g_free(msg);
return FALSE;
}
@@ -821,7 +823,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("win32_spawn: Stdout pipe creation failed (%d)", (gint) GetLastError());
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
g_free(msg);
return FALSE;
}
@@ -834,7 +837,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("win32_spawn: Stderr pipe creation failed");
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
g_free(msg);
return FALSE;
}
@@ -847,8 +851,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("win32_spawn: Stdin pipe creation failed");
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, g_win32_error_message (GetLastError()));
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
g_free(msg);
return FALSE;
}
@@ -911,7 +915,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetContentFromHandle: Alloc failed");
- *error = g_error_new(G_SPAWN_ERROR, G_SPAWN_ERROR, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_SPAWN_ERROR, msg);
g_free(msg);
return FALSE;
}
@@ -922,7 +927,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetContentFromHandle: Cannot read tempfile");
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_FAILED, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_FAILED, msg);
g_free(msg);
return FALSE;
}
@@ -931,7 +937,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetContentFromHandle: CloseHandle failed (%d)", (gint) GetLastError());
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_FAILED, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_FAILED, msg);
g_free(msg);
g_free(buffer);
*content = NULL;
@@ -976,7 +983,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("CreateChildProcess: CreateProcess failed");
- *error = g_error_new(G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, msg);
+ if (*error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, msg);
g_free(msg);
return FALSE;
}
@@ -994,8 +1002,9 @@
if (GetExitCodeProcess(piProcInfo.hProcess, &gw_spawn->dwExitCode) != 0)
{
gchar *msg = g_win32_error_message(GetLastError());
- geany_debug("GetExitCodeProcess failed");
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_FAILED, msg);
+ geany_debug("GetExitCodeProcess failed: %s", msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_FAILED, msg);
g_free(msg);
}
CloseHandle(piProcInfo.hProcess);
@@ -1017,7 +1026,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("ReadFromPipe: Closing handle failed");
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR_PIPE, msg);
g_free(msg);
return;
}
@@ -1052,7 +1062,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetTempFileHandle: GetTempPath failed (%d)", (gint) GetLastError());
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
g_free(msg);
return NULL;
}
@@ -1066,7 +1077,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetTempFileName failed (%d)", (gint) GetLastError());
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
g_free(msg);
return NULL;
}
@@ -1083,7 +1095,8 @@
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetTempFileHandle: Second CreateFile failed (%d)", (gint) GetLastError());
- *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
+ if (error != NULL)
+ *error = g_error_new(G_SPAWN_ERROR, G_FILE_ERROR, msg);
g_free(msg);
return NULL;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list