pidgin: 2530757a: Avoid some asserts with WBFO.
qulogic at pidgin.im
qulogic at pidgin.im
Fri Jun 8 03:12:18 EDT 2012
----------------------------------------------------------------------
Revision: 2530757adc4c1d2ba51a9f2394e38b4f322d2684
Parent: 77a65d8b0ab27873da39035bc815d62e12a4fde5
Author: qulogic at pidgin.im
Date: 06/05/12 21:55:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2530757adc4c1d2ba51a9f2394e38b4f322d2684
Changelog:
Avoid some asserts with WBFO.
Changes against parent 77a65d8b0ab27873da39035bc815d62e12a4fde5
patched pidgin/gtkwebview.c
-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c d68f841eacc522027ab665296bf0375b30391573
+++ pidgin/gtkwebview.c 6678f0a6fe39bd405ce60c5b7576838ed380f3ee
@@ -315,8 +315,8 @@ do_formatting(GtkWebView *webview, const
{
GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
WebKitDOMDocument *dom;
- WebKitDOMDOMWindow *win = NULL;
- WebKitDOMDOMSelection *sel;
+ WebKitDOMDOMWindow *win;
+ WebKitDOMDOMSelection *sel = NULL;
WebKitDOMRange *range = NULL;
dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
@@ -324,7 +324,8 @@ do_formatting(GtkWebView *webview, const
if (priv->edit.wbfo) {
win = webkit_dom_document_get_default_view(dom);
sel = webkit_dom_dom_window_get_selection(win);
- range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
+ if (webkit_dom_dom_selection_get_range_count(sel) > 0)
+ range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview));
}
@@ -333,9 +334,12 @@ do_formatting(GtkWebView *webview, const
priv->edit.block_changed = FALSE;
if (priv->edit.wbfo) {
- sel = webkit_dom_dom_window_get_selection(win);
- webkit_dom_dom_selection_remove_all_ranges(sel);
- webkit_dom_dom_selection_add_range(sel, range);
+ if (range) {
+ webkit_dom_dom_selection_remove_all_ranges(sel);
+ webkit_dom_dom_selection_add_range(sel, range);
+ } else {
+ webkit_dom_dom_selection_collapse_to_end(sel, NULL);
+ }
}
}
More information about the Commits
mailing list