Skip to content

Commit

Permalink
Fix possible crash on quit
Browse files Browse the repository at this point in the history
When quitting, we still have to destroy the Scintilla widget to avoid
any possibility for us to receive signals from it after we destroyed
the associated editor and/or document (used in signal handlers).

I myself don't suffer from the issue, but it is theoretically possible
for Scintilla to emit signals anytime before it is destroyed, so it is
safer like this anyway.  And an user on IRC suffered from crashes on
quit because of this issue, so it seems to actually happen in some
situations.
  • Loading branch information
b4n committed Apr 12, 2014
1 parent f74b4ed commit 3cf35f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/document.c
Expand Up @@ -592,7 +592,14 @@ static gboolean remove_page(guint page_num)

doc->is_valid = FALSE;

if (! main_status.quitting)
if (main_status.quitting)
{
/* we need to destroy the ScintillaWidget so our handlers on it are
* disconnected before we free any data they may use (like the editor).
* when not quitting, this is handled by removing the notebook page. */
gtk_widget_destroy(doc->editor->sci);
}
else
{
notebook_remove_page(page_num);
sidebar_remove_document(doc);
Expand Down

0 comments on commit 3cf35f2

Please sign in to comment.