Open wolfenrain opened 7 years ago
Please provide reproducing code.
Hmm I just recreated the problem. And found out that it has nothing to with file inclusion.. But I still don't have a clue what happening so atleast its worth asking.
Here is a the reproduced code.
<?php
use \UI\Controls\Box;
use \UI\Window;
use \UI\Point;
use \UI\Size;
use \UI\Draw\Pen;
class Exer extends \UI\Executor
{
public function __construct(Area $area)
{
$this->area = $area;
parent::__construct();
}
public function onExecute()
{
$this->area->redraw();
}
}
class CustomWindow extends Window
{
public function addExecutor(\UI\Executor $executor)
{
$this->executors[] = $executor;
}
protected function onClosing()
{
foreach($this->executors as $executor)
{
$executor->kill();
}
$this->destroy();
\UI\quit();
}
}
class Base extends \UI\Area
{
public function __construct(Box $box)
{
$box->append($this, true);
}
protected function onDraw(Pen $pen, Size $size, Point $clip, Size $clipSize)
{
$zero = new Point(0, 0);
$frame = $zero + 40;
$frameSize = $size + 80;
$path = new \UI\Draw\Path();
$path->addRectangle($zero, $size);
$path->end();
$pen->fill($path, $this->backColor);
}
public function setExecutor(\UI\Executor $executor)
{
$this->executor = $executor;
}
}
$window = new CustomWindow("Window", new Size(640, 480), false);
$box = new Box(Box::Vertical);
$sb = new Base($box);
$exe = new Exer($sb);
$window->add($box);
$window->addExecutor($exe);
$sb->setExecutor($exe);
$window->show();
\UI\run();
?>
Whenever I try to create an class with the UI\Executor abstract class I get an "Segmentation fault (core dumped)" on Linux, it only happends when that particular class is in another file.
So if call it from the file that gets executed first then there is no problem. So basically, the Executor isn't able to become an instance because he tries to write to certain memory from which he has no access. I assume its the main thread's memory.