fxruby 1.6.31 → 1.6.32.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c657df6afb071db3ac6cd379ba544ab9a041e05
4
- data.tar.gz: 420d9a5a14de3ced2f355bf256da1cb3bab2a4cf
3
+ metadata.gz: cd8545ecb6b779f4edd4d0c5580d8ac5efb126a8
4
+ data.tar.gz: 7bb176820e5eceee88c82ee8b916f3de00ebb9ac
5
5
  SHA512:
6
- metadata.gz: a463b699c583cd8196654d7abbbb298e75aa4d87f353c49014ed12ffd9bb37290c8fa57df151f6775a01a8ef6daf91ac738da743bf929045f7e2fccb9526ac2e
7
- data.tar.gz: d7660b4c0f1fc8e2d277fec3b23c0e930fc7196a027314caffc0a3b054f7630fde56a922cf46e3f7a1998d9776a6f2ab9afdc7ccaed85f8550def937d4582874
6
+ metadata.gz: b41b86c915aceb98ca1e00f148e6c96f9a89c2197651840b9087ab2286cf8d6d971f325b610093e747bf093ff0b1c05a0d30089d6b1e5adcf4bf1df5c19aa504
7
+ data.tar.gz: 6ae7c95c2b8263b59a4a9ad4119354788e0f09b1595727209b84cae798729d401e821f409a0d0d8f8199abbd2ae7506fd79a62acaea39c1a2cbd7f71cc165bdb
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.6.32 / unreleased
2
+
3
+ * Avoid call to rb_class2name() during GC. Fixes #21
4
+ * Use release mode, unless extconf.rb is called with --enable-debug,
5
+ so that all FXTRACE() and FXASSERT() calls are skiped, per default.
6
+
1
7
  === 1.6.31 / 2015-07-21
2
8
 
3
9
  * Replace pipe2() by pipe() and fcntl(), because pipe2() is not as portable.
@@ -83,6 +83,17 @@ swig_type_info *FXRbTypeQuery(const char *desc){
83
83
 
84
84
  static st_table * FXRuby_Objects;
85
85
 
86
+ static const char * const safe_rb_obj_classname(VALUE obj)
87
+ {
88
+ if( rb_during_gc() ){
89
+ /* It's not safe to call rb_obj_classname() during GC.
90
+ * Return dummy value in this case. */
91
+ return "during GC";
92
+ } else {
93
+ return rb_obj_classname(obj);
94
+ }
95
+ }
96
+
86
97
  /**
87
98
  * Each value in the FXRuby_Objects hash table is an instance of this
88
99
  * struct. It identifies the Ruby instance associated with a C++ object.
@@ -115,7 +126,7 @@ VALUE FXRbNewPointerObj(void *ptr,swig_type_info* ty){
115
126
  FXRubyObjDesc *desc;
116
127
  if(FXMALLOC(&desc,FXRubyObjDesc,1)){
117
128
  obj=SWIG_Ruby_NewPointerObj(ptr,ty,1);
118
- FXTRACE((1,"FXRbNewPointerObj(foxObj=%p) => rubyObj=%p (%s)\n",ptr,(void *)obj,rb_obj_classname(obj)));
129
+ FXTRACE((1,"FXRbNewPointerObj(foxObj=%p) => rubyObj=%p (%s)\n",ptr,(void *)obj,safe_rb_obj_classname(obj)));
119
130
  desc->obj=obj;
120
131
  desc->borrowed=true;
121
132
  desc->in_gc=false;
@@ -150,25 +161,6 @@ bool FXRbIsBorrowed(void* ptr){
150
161
  }
151
162
  }
152
163
 
153
- bool FXRbSetInGC(const void* ptr, bool enabled){
154
- FXASSERT(ptr!=0);
155
- FXRubyObjDesc *desc;
156
- if(st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(ptr),reinterpret_cast<st_data_t *>(&desc))!=0){
157
- desc->in_gc=enabled;
158
- return enabled;
159
- }
160
- return false;
161
- }
162
-
163
- bool FXRbIsInGC(const void* ptr){
164
- FXASSERT(ptr!=0);
165
- FXRubyObjDesc *desc;
166
- if(st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(ptr),reinterpret_cast<st_data_t *>(&desc))!=0){
167
- return desc->in_gc;
168
- }
169
- return false;
170
- }
171
-
172
164
 
173
165
  /**
174
166
  * FXRbConvertPtr() is just a wrapper around SWIG_ConvertPtr().
@@ -267,7 +259,7 @@ void FXRbRegisterRubyObj(VALUE rubyObj,const void* foxObj) {
267
259
  FXASSERT(!NIL_P(rubyObj));
268
260
  FXASSERT(foxObj!=0);
269
261
  FXRubyObjDesc* desc;
270
- FXTRACE((1,"FXRbRegisterRubyObj(rubyObj=%p (%s),foxObj=%p)\n",(void *)rubyObj,rb_obj_classname(rubyObj),foxObj));
262
+ FXTRACE((1,"FXRbRegisterRubyObj(rubyObj=%p (%s),foxObj=%p)\n",(void *)rubyObj,safe_rb_obj_classname(rubyObj),foxObj));
271
263
  if(st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(const_cast<void*>(foxObj)),reinterpret_cast<st_data_t *>(&desc))!=0){
272
264
  FXASSERT(desc->borrowed);
273
265
  /* There is already a Ruby object registered for this foxObj.
@@ -308,7 +300,7 @@ void FXRbUnregisterRubyObj2(const void* foxObj, bool alsoOwned){
308
300
  FXRubyObjDesc* desc;
309
301
  if(st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(const_cast<void*>(foxObj)),reinterpret_cast<st_data_t *>(&desc))!=0){
310
302
  if( !alsoOwned && !desc->borrowed ) return;
311
- FXTRACE((1,"FXRbUnregisterRubyObj(rubyObj=%p (%s),foxObj=%p)\n",(void *)desc->obj,rb_obj_classname(desc->obj),foxObj));
303
+ FXTRACE((1,"FXRbUnregisterRubyObj(rubyObj=%p (%s),foxObj=%p)\n",(void *)desc->obj,safe_rb_obj_classname(desc->obj),foxObj));
312
304
  DATA_PTR(desc->obj)=0;
313
305
  FXFREE(&desc);
314
306
  st_delete(FXRuby_Objects,reinterpret_cast<st_data_t *>(const_cast<void**>(&foxObj)),reinterpret_cast<st_data_t *>(0));
@@ -356,7 +348,7 @@ VALUE FXRbGetRubyObj(const void *foxObj,bool alsoBorrowed){
356
348
  if(foxObj!=0 && st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(const_cast<void*>(foxObj)),reinterpret_cast<st_data_t *>(&desc))!=0){
357
349
  FXASSERT(desc!=0);
358
350
  if(alsoBorrowed || !desc->borrowed){
359
- FXTRACE((2,"FXRbGetRubyObj(foxObj=%p) => rubyObj=%p (%s)\n",foxObj,(void *)desc->obj,rb_obj_classname(desc->obj)));
351
+ FXTRACE((2,"FXRbGetRubyObj(foxObj=%p) => rubyObj=%p (%s)\n",foxObj,(void *)desc->obj,safe_rb_obj_classname(desc->obj)));
360
352
  return desc->obj;
361
353
  }
362
354
  }
@@ -1435,7 +1427,6 @@ void FXRbRange2LoHi(VALUE range,FXdouble& lo,FXdouble& hi){
1435
1427
  void FXRbCallVoidMethod_gvlcb(FXObject* recv, const char *func) {
1436
1428
  VALUE obj=FXRbGetRubyObj(recv,false);
1437
1429
  FXASSERT(!NIL_P(obj));
1438
- FXASSERT(!FXRbIsInGC(recv));
1439
1430
  rb_funcall(obj,rb_intern(func),0,NULL);
1440
1431
  }
1441
1432
 
@@ -1642,7 +1633,7 @@ void FXRbCallDCDrawMethod_gvlcb(FXDC* recv, const char * func, FXint x,FXint y,c
1642
1633
  FXRbMenuCommand::~FXRbMenuCommand(){
1643
1634
  FXAccelTable *table;
1644
1635
  FXWindow *owner;
1645
- if(acckey && !FXRbIsInGC(this)){
1636
+ if(acckey && !rb_during_gc()){
1646
1637
  owner=getShell()->getOwner();
1647
1638
  if(owner){
1648
1639
  table=owner->getAccelTable();
@@ -1658,7 +1649,7 @@ FXRbMenuCommand::~FXRbMenuCommand(){
1658
1649
  FXRbMenuCheck::~FXRbMenuCheck(){
1659
1650
  FXAccelTable *table;
1660
1651
  FXWindow *owner;
1661
- if(acckey && !FXRbIsInGC(this)){
1652
+ if(acckey && !rb_during_gc()){
1662
1653
  owner=getShell()->getOwner();
1663
1654
  if(owner){
1664
1655
  table=owner->getAccelTable();
@@ -1674,7 +1665,7 @@ FXRbMenuCheck::~FXRbMenuCheck(){
1674
1665
  FXRbMenuRadio::~FXRbMenuRadio(){
1675
1666
  FXAccelTable *table;
1676
1667
  FXWindow *owner;
1677
- if(acckey && !FXRbIsInGC(this)){
1668
+ if(acckey && !rb_during_gc()){
1678
1669
  owner=getShell()->getOwner();
1679
1670
  if(owner){
1680
1671
  table=owner->getAccelTable();
@@ -230,6 +230,7 @@ def do_rake_compiler_setup
230
230
  "--without-x",
231
231
  "--enable-shared",
232
232
  "--disable-static",
233
+ enable_config("debug") ? "--enable-debug" : "--enable-release",
233
234
  ]
234
235
  class << recipe
235
236
  def compile
@@ -390,6 +391,10 @@ unless enable_config("win32-cross")
390
391
  end
391
392
  end
392
393
 
394
+ unless enable_config("debug")
395
+ $CPPFLAGS += " -DNDEBUG"
396
+ end
397
+
393
398
  # Platform-specific modifications
394
399
  do_rake_compiler_setup
395
400
 
@@ -149,7 +149,7 @@ inline void klass ## _dropDisable(klass* self){ \
149
149
  FXRbCallVoidMethod(this,"killFocus"); \
150
150
  } \
151
151
  void cls::changeFocus(FXWindow* child){ \
152
- if(!FXRbIsInGC(this)) FXRbCallVoidMethod(this,"changeFocus",child); \
152
+ if(!rb_during_gc()) FXRbCallVoidMethod(this,"changeFocus",child); \
153
153
  } \
154
154
  void cls::setDefault(FXbool enable){ \
155
155
  FXRbCallVoidMethod(this,"setDefault",enable); \
@@ -173,7 +173,7 @@ inline void klass ## _dropDisable(klass* self){ \
173
173
  FXRbCallVoidMethod(this,"position",x,y,w,h); \
174
174
  } \
175
175
  void cls::recalc(){ \
176
- if(!FXRbIsInGC(this)) FXRbCallVoidMethod(this,"recalc"); \
176
+ if(!rb_during_gc()) FXRbCallVoidMethod(this,"recalc"); \
177
177
  } \
178
178
  void cls::reparent(FXWindow* father,FXWindow* other){ \
179
179
  FXRbCallVoidMethod(this,"reparent",father,other); \
@@ -81,8 +81,6 @@ VALUE showHelper(VALUE self, int argc, VALUE *argv, TYPE *p, swig_type_info *typ
81
81
  // Wrapper around SWIG_Ruby_NewPointerObj()
82
82
  VALUE FXRbNewPointerObj(void *ptr, swig_type_info *typeinfo);
83
83
  bool FXRbIsBorrowed(void* ptr);
84
- bool FXRbSetInGC(const void* ptr, bool enabled);
85
- bool FXRbIsInGC(const void* ptr);
86
84
 
87
85
  // Wrapper around SWIG_TypeQuery()
88
86
  swig_type_info *FXRbTypeQuery(const char *name);
@@ -369,7 +367,6 @@ template<class TYPE>
369
367
  void FXRbCallVoidMethod_gvlcb(FXObject* recv,const char *func, TYPE& arg){
370
368
  VALUE obj=FXRbGetRubyObj(recv,false);
371
369
  FXASSERT(!NIL_P(obj));
372
- FXASSERT(!FXRbIsInGC(recv));
373
370
  rb_funcall(obj,rb_intern(func),1,to_ruby(arg));
374
371
  FXRbUnregisterBorrowedRubyObj(&arg);
375
372
  }
@@ -386,7 +383,6 @@ template<class TYPE>
386
383
  void FXRbCallVoidMethod_gvlcb(const FXObject* recv, const char *func, TYPE& arg){
387
384
  VALUE obj=FXRbGetRubyObj(recv,false);
388
385
  FXASSERT(!NIL_P(obj));
389
- FXASSERT(!FXRbIsInGC(recv));
390
386
  rb_funcall(obj,rb_intern(func),1,to_ruby(arg));
391
387
  FXRbUnregisterBorrowedRubyObj(&arg);
392
388
  }
@@ -53,19 +53,6 @@ void FXRbObject::markfunc(FXObject* obj){
53
53
  FXTRACE((100,"%s::markfunc(%p)\n",obj?obj->getClassName():"FXRbObject",obj));
54
54
  }
55
55
 
56
- static void FXRbSetInGCParentsRecursive(FXWindow *window, bool enabled){
57
- FXRbSetInGC( window, true );
58
- if(window->getParent()) FXRbSetInGCParentsRecursive( window->getParent(), enabled );
59
- }
60
-
61
- static void FXRbSetInGCChildrenRecursive(FXWindow *window, bool enabled){
62
- FXRbSetInGC( window, true );
63
- for(FXWindow* child=window->getFirst(); child; child=child->getNext()){
64
- FXRbSetInGCChildrenRecursive( child, enabled );
65
- }
66
- }
67
-
68
-
69
56
  void FXRbObject::freefunc(FXObject* self){
70
57
  if(self!=0){
71
58
  // Unregister, but don't destroy, borrowed references
@@ -78,17 +65,6 @@ void FXRbObject::freefunc(FXObject* self){
78
65
  FXASSERT(classname!=0);
79
66
  FXASSERT(strlen(classname)>3);
80
67
  if(classname[0]=='F' && classname[1]=='X' && classname[2]=='R' && classname[3]=='b'){
81
- // FXWindow destructor calls recalc() and changeFocus() of it's parent window.
82
- // Since these methods are routed back to Ruby code, but calling Ruby code from
83
- // GC isn't a good idea, we mark the parent window as "in_gc", so that it will
84
- // ignore recalc() and changeFocus() calls completely.
85
- // The parent window should also be scheduled to be free'd. In the other case,
86
- // the child window would have been marked as used.
87
- if(self->isMemberOf(FXMETACLASS(FXWindow))){
88
- FXWindow *window = dynamic_cast<FXWindow*>(self);
89
- FXRbSetInGCParentsRecursive( window, true );
90
- FXRbSetInGCChildrenRecursive( window, true );
91
- }
92
68
  delete self;
93
69
  }
94
70
  else{
data/lib/fox16/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Fox
2
2
  def Fox.fxrubyversion
3
- "1.6.31"
3
+ "1.6.32.pre1"
4
4
  end
5
5
  end
@@ -67,12 +67,12 @@ class TC_FXTreeList < Fox::TestCase
67
67
  @treeList.connect(SEL_INSERTED) { |sender, sel, ptr|
68
68
  anItem = ptr
69
69
  }
70
- theItem = @treeList.appendItem(nil, "", nil, nil, nil, true)
70
+ theItem = @treeList.appendItem(nil, FXTreeItem.new(""), true)
71
71
  assert_same(theItem, anItem)
72
72
  end
73
73
 
74
74
  def test_SEL_DELETED
75
- theItem = @treeList.appendItem(nil, "")
75
+ theItem = @treeList.appendItem(nil, FXTreeItem.new(""))
76
76
  anItem = nil
77
77
  @treeList.connect(SEL_DELETED) { |sender, sel, ptr|
78
78
  anItem = ptr
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fxruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.31
4
+ version: 1.6.32.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyle Johnson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-21 00:00:00.000000000 Z
12
+ date: 2015-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mini_portile
@@ -1025,9 +1025,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1025
1025
  version: '0'
1026
1026
  required_rubygems_version: !ruby/object:Gem::Requirement
1027
1027
  requirements:
1028
- - - ">="
1028
+ - - ">"
1029
1029
  - !ruby/object:Gem::Version
1030
- version: '0'
1030
+ version: 1.3.1
1031
1031
  requirements: []
1032
1032
  rubyforge_project:
1033
1033
  rubygems_version: 2.4.8