Project

General

Profile

Script exception when using WTableView

Added by Ulf Johnsson almost 5 years ago

Hi!

I have a hard-to-recreate problem when using WTableView, (I am using the latest version of Wt3).

The issue I am running into is that I get a script exception in my browser when using WTableView under very specific conditions.

To reproduce the issue I have:

1) a WTableView with 500 rows (I use it like a list, meaning there is only 1 column)

2) I run prime95 to stress the computer (the issue seems easiest to reproduce when the computer resources are scarse)

3) My table uses dynamic-sorting

4) I have a custom delegate

Unfortunatly I have not been able to recrate this issue in a small exmaple yet.

The exception that occurs in the browser is that a script tries to get one of the widgets created by the delegate, but the resulting node is null.

The output looks like this:

var j48=Wt3_3_12.$('OLView34');
j48.className='WQWebApi_WebObjects_WebObjectList_separator WQApplicationTheme_1270012122';
j48.style.position='relative';
j48.style.width='639.0px';
j48.style.height='20.0px';
j48.style.left='0.0px';
j48.style.right='auto';
j48.style.top='0.0px';
j48.style.bottom='auto';
j48.style.borderTop='';
j48.style.borderRight='';
j48.style.borderBottom='';
j48.style.borderLeft='';
Wt3_3_12.setHtml(j48,'<div id=\""oq69shc\"" onclick=\""var e=event||window.event,o=this;if($(o).hasClass(\\'Wt-disabled\\')){Wt3_3_12.cancelEvent(e);return;}Wt._p_.update(o,\\'s6bf\\',e,true);\"" onmousedown=\""var e=event||window.event,o=this;if($(o).hasClass(\\'Wt-disabled\\')){Wt3_3_12.cancelEvent(e);return;}Wt._p_.saveDownPos(event);Wt3_3_12.capture(this);Wt3_3_12.mouseDown(e);Wt._p_.update(o,\\'s6c1\\',e,true);\"" onmouseup=\""var e=event||window.event,o=this;if($(o).hasClass(\\'Wt-disabled\\')){Wt3_3_12.cancelEvent(e);return;}Wt3_3_12.mouseUp(e);Wt._p_.update(o,\\'s6c0\\',e,true);\"" onmousemove=\""var e=event||window.event,o=this;Wt._p_.update(o,\\'s6c2\\',e,true);\"" onmouseout=\""var e=event||window.event,o=this;Wt._p_.update(o,\\'s6c3\\',e,true);\"" style=\""width:639.0px;height:20.0px;\""><div id=\""poq69shc\"" style=\""position:relative;overflow-x:hidden;overflow-y:hidden;\""><canvas id=\""coq69shc\"" height=\""20\"" width=\""639\"" style=\""display:block;\""></canvas></div></div>');
new Wt3_3_12.WPaintedWidget(Wt,Wt3_3_12.$('oq69shc'));
;(function(){var pF=function(){if(Wt3_3_12.getElement('coq69shc').getContext){var ctx=Wt3_3_12.getElement('coq69shc').getContext('2d');if (!ctx.setLineDash) {ctx.setLineDash = function(a){};}ctx.clearRect(0,0,639,20);ctx.save();ctx.restore();ctx.save();Wt3_3_12.gfxUtils.setClipPath(ctx,[[0,0,0],[639.0,0,1],[639.0,20.0,1],[0,20.0,1],[0,0,1]],[1.0,0,0,1.0,0,0],true);ctx.strokeStyle='rgb(0,0,0)';ctx.lineWidth=1.0;ctx.lineCap='square';ctx.fillStyle='rgb(255,255,255)';ctx.shadowOffsetX=0;ctx.shadowOffsetY=0;ctx.shadowBlur=0;ctx.shadowColor='rgb(0,0,0)';ctx.font='10.0pt sans-serif ';ctx.beginPath();ctx.moveTo(0,0);ctx.lineTo(639.0,0);ctx.lineTo(639.0,20.0);ctx.lineTo(0,20.0);ctx.lineTo(0,0);ctx.moveTo(0,0);ctx.fill();
ctx.restore();}};Wt3_3_12.$('oq69shc').wtObj.repaint=pF;pF=function(){Wt3_3_12.$('oq69shc').wtObj.repaint();};var o=Wt3_3_12.$('oq69shc').wtObj;o.cancelPreloaders();if(Wt3_3_12.getElement('coq69shc').getContext){var l=new Wt._p_.ImagePreloader([],function(images){this.done = true;var o=Wt3_3_12.$('oq69shc').wtObj;if(o.imagePreloaders.length===0||this===o.imagePreloaders[0]){o.images=images;pF();o.imagePreloaders.shift();}else{while(o.imagePreloaders.length>0&&o.imagePreloaders[0].done){o.imagePreloaders[0].callback(o.imagePreloaders[0].images);}}});if(!l.done)o.imagePreloaders.push(l);}})();

And the exception is:

WApplication: JavaScript error: {""exception_description"":""j48 is null""

The node j48 is supposed to be a widget created by the delegate, I recognize the ID.

There is a whole lot more output were other delegate-widgets are accessed (with identical code as posted output, but with different IDs) both before and after the it tries to access the node j48.

It seems like sometimes all widgets in the tableview are not available in the browsers node-structure.

I will continue to attempt to create a small example that shows the problem, but it has proven to be very difficult and I am hoping that you guys might have an idea of where the problem might be located.

BR, Ulf.