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.
This commit is contained in:
parent
371810181d
commit
6c6eccd994
@ -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 */
|
||||
|
||||
|
||||
#ifdef GEANY_PRIVATE
|
||||
#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
|
||||
#endif
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifdef GEANY_PRIVATE
|
||||
# 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
|
||||
|
||||
void sci_set_text (ScintillaObject *sci, const gchar *text);
|
||||
gboolean sci_has_selection (ScintillaObject *sci);
|
||||
void sci_end_undo_action (ScintillaObject *sci);
|
||||
|
Loading…
x
Reference in New Issue
Block a user