Package: wxwidgets3.0 / 3.0.2+dfsg-4

ed88188be7e97a0503f3471f7b0452740b732902.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
## Description: add some description
## Origin/Author: add some origin or author
## Bug: bug URL
From ed88188be7e97a0503f3471f7b0452740b732902 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Tue, 10 Feb 2015 23:14:53 +0000
Subject: [PATCH] Fix spurious assert in wxGTK wxDataViewCtrl::EditItem().

The assert in wxGtkTreeSelectionLock ctor failed after the first time this
object was created as it doesn't reset the selection function to NULL with
wxGTK2, fix this by checking for different values depending on whether it's
actually the first time we do it or not.

In the future we should just reset the selection function to NULL as it does
work in GTK+ 3, also update the comment explaining the problem to mention this.

(cherry picked from commit 24c0401e81a4d0206f89b21775adb90fb11bf32a)
---
 src/gtk/dataview.cpp | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index 87217e2..0be3273 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -135,9 +135,11 @@ class wxGtkTreePathList : public wxGtkList
 
 // Implementation note: it could be expected that setting the selection
 // function in this class ctor and resetting it back to the old value in its
-// dtor would work. However currently gtk_tree_selection_get_select_function()
-// can't be passed NULL (see https://bugzilla.gnome.org/show_bug.cgi?id=626276)
-// so we can't do this. Instead, we always use the selection function (which
+// dtor would work, However in GTK+2 gtk_tree_selection_get_select_function()
+// can't be passed NULL (see https://bugzilla.gnome.org/show_bug.cgi?id=626276
+// which was only fixed in 2.90.5-304-g316b9da) so we can't do this.
+//
+// Instead, we always use the selection function (which
 // imposes extra overhead, albeit minimal one, on all selection operations) and
 // just set/reset the flag telling it whether it should allow or forbid the
 // selection.
@@ -168,7 +170,15 @@ class wxGtkTreeSelectionLock
 
         ms_instance = this;
 
-        CheckCurrentSelectionFunc(NULL);
+        if ( ms_firstTime )
+        {
+            ms_firstTime = false;
+            CheckCurrentSelectionFunc(NULL);
+        }
+        else
+        {
+            CheckCurrentSelectionFunc(wxdataview_selection_func);
+        }
 
         // Pass some non-NULL pointer as "data" for the callback, it doesn't
         // matter what it is as long as it's non-NULL.
@@ -215,6 +225,7 @@ class wxGtkTreeSelectionLock
     }
 
     static wxGtkTreeSelectionLock *ms_instance;
+    static bool ms_firstTime;
 
     GtkTreeSelection * const m_selection;
 
@@ -222,6 +233,7 @@ class wxGtkTreeSelectionLock
 };
 
 wxGtkTreeSelectionLock *wxGtkTreeSelectionLock::ms_instance = NULL;
+bool wxGtkTreeSelectionLock::ms_firstTime = true;
 
 //-----------------------------------------------------------------------------
 // wxDataViewCtrlInternal