Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Matthew Brush mbrush@codebrainz.ca Date: Fri, 04 Aug 2017 06:48:30 UTC Commit: 6c6eccd994dd4af68afe32b6b606b935e7328d2d https://github.com/geany/geany/commit/6c6eccd994dd4af68afe32b6b606b935e7328d...
Log Message: ----------- Check Scintilla status in debug builds
In the future, this could be moved to release-mode runtime errors which try and pop-up a dialog message and/or recover gracefully.
Modified Paths: -------------- src/sciwrappers.c src/sciwrappers.h
Modified: src/sciwrappers.c 26 lines changed, 26 insertions(+), 0 deletions(-) =================================================================== @@ -42,6 +42,32 @@ #include <string.h>
+#ifndef NDEBUG +sptr_t sci_send_message_internal (const gchar *file, guint line, ScintillaObject *sci, + guint msg, uptr_t wparam, sptr_t lparam) +{ + sptr_t result; + gint status; + + scintilla_send_message(sci, SCI_SETSTATUS, 0, 0); + result = scintilla_send_message(sci, msg, wparam, lparam); + status = scintilla_send_message(sci, SCI_GETSTATUS, 0, 0); + + if (status != 0) + { + static const gchar *fmt = "%s:%u: scintilla message '%u' failed " + "on instance '%p' with wParam='%llu' and lParam='%llu'"; + if (status < SC_STATUS_WARN_START) + g_critical(fmt, file, line, msg, (gpointer)sci, wparam, lparam); + else + g_warning(fmt, file, line, msg, (gpointer)sci, wparam, lparam); + } + + return result; +} +#endif + + /* line numbers visibility */ void sci_set_line_numbers(ScintillaObject *sci, gboolean set) {
Modified: src/sciwrappers.h 13 lines changed, 9 insertions(+), 4 deletions(-) =================================================================== @@ -28,13 +28,18 @@ #include "ScintillaWidget.h" /* for ScintillaObject */
+G_BEGIN_DECLS + #ifdef GEANY_PRIVATE -#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l) +# ifndef NDEBUG +# define SSM(s, m, w, l) sci_send_message_internal(__FILE__, __LINE__, s, m, w, l) +sptr_t sci_send_message_internal (const gchar *file, guint line, ScintillaObject *sci, + guint msg, uptr_t wparam, sptr_t lparam); +# else +# define SSM(s, m, w, l) scintilla_send_message(s, m, w, l) +# endif #endif
- -G_BEGIN_DECLS - void sci_set_text (ScintillaObject *sci, const gchar *text); gboolean sci_has_selection (ScintillaObject *sci); void sci_end_undo_action (ScintillaObject *sci);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).