Kaydet (Commit) 6c6eccd9 authored tarafından Matthew Brush's avatar Matthew Brush Kaydeden (comit) Matthew Brush

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.
üst 37181018
......@@ -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)
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment