Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/creator/creator_signals.c')
-rw-r--r--source/creator/creator_signals.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c
index 81e6178c502..feb108da289 100644
--- a/source/creator/creator_signals.c
+++ b/source/creator/creator_signals.c
@@ -64,6 +64,7 @@
#include "BKE_main.h"
#include "BKE_report.h"
+
/* for passing information between creator and gameengine */
#ifdef WITH_GAMEENGINE
# include "BL_System.h"
@@ -75,6 +76,12 @@
#include "creator_intern.h" /* own include */
+// #define USE_WRITE_CRASH_BLEND
+#ifdef USE_WRITE_CRASH_BLEND
+# include "BKE_undo_system.h"
+# include "BLO_undofile.h"
+#endif
+
/* set breakpoints here when running in debug mode, useful to catch floating point errors */
#if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE)
static void sig_handle_fpe(int UNUSED(sig))
@@ -110,29 +117,32 @@ static void sig_handle_crash_backtrace(FILE *fp)
static void sig_handle_crash(int signum)
{
+ wmWindowManager *wm = G.main->wm.first;
-#if 0
- {
- char fname[FILE_MAX];
+#ifdef USE_WRITE_CRASH_BLEND
+ if (wm->undo_stack) {
+ struct MemFile *memfile = BKE_undosys_stack_memfile_get_active(wm->undo_stack);
+ if (memfile) {
+ char fname[FILE_MAX];
- if (!G.main->name[0]) {
- BLI_make_file_string("/", fname, BKE_tempdir_base(), "crash.blend");
- }
- else {
- BLI_strncpy(fname, G.main->name, sizeof(fname));
- BLI_replace_extension(fname, sizeof(fname), ".crash.blend");
- }
+ if (!G.main->name[0]) {
+ BLI_make_file_string("/", fname, BKE_tempdir_base(), "crash.blend");
+ }
+ else {
+ BLI_strncpy(fname, G.main->name, sizeof(fname));
+ BLI_replace_extension(fname, sizeof(fname), ".crash.blend");
+ }
- printf("Writing: %s\n", fname);
- fflush(stdout);
+ printf("Writing: %s\n", fname);
+ fflush(stdout);
- BKE_undo_save_file(fname);
+ BLO_memfile_write_file(memfile, fname);
+ }
}
#endif
FILE *fp;
char header[512];
- wmWindowManager *wm = G.main->wm.first;
char fname[FILE_MAX];
@@ -338,4 +348,4 @@ void main_signal_setup_fpe(void)
#endif
}
-#endif /* WITH_PYTHON_MODULE */ \ No newline at end of file
+#endif /* WITH_PYTHON_MODULE */