Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP randomly crashes on filling TreeView #169

Open
Nijhuis opened this issue Nov 11, 2024 · 32 comments
Open

PHP randomly crashes on filling TreeView #169

Nijhuis opened this issue Nov 11, 2024 · 32 comments

Comments

@Nijhuis
Copy link

Nijhuis commented Nov 11, 2024

When trying to filling a TreeView with code below, CLI just randomly crashes somtimes, while other times it will execute the code as intended.

 function Treeview_Fill($object, $columns = array(), $data = array(), $failer = false) {
     var_dump($object);
     echo "a";
     $column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 0);
     echo "b";
     $object->append_column($column1);
     echo "c";
     $model = new GtkListStore(GObject::TYPE_STRING);
     echo "d";
     $object->set_model($model);
     echo "e";
 
     return true;
 }

Sometimes the code gets to b, sometimes to c, sometimes to d. There is no logic behind this and no errors to debug.

@scorninpc
Copy link
Owner

Hey Nijhuis, sorry for delay

Can you provide all code? what are calling Treeview_Fill ?

I imagine the problem is the 0 on GtkTreeViewColumn, always do ZERO will cause a memory problem, but I can only confirm if I can reproduce the problem

What package are you running? appimage? windows?

@Nijhuis
Copy link
Author

Nijhuis commented Nov 14, 2024

I am running on Windows 11, using php-gtk3-x86_64-0.16-beta-windows. This code is a port from PHP5.6 and GTK2.
Replacing the 0 in the GtkTreeViewColumn function did not change anything.

The folowing glade file (MainApp.glade) gets loaded:
`

1400 940 False MyApp False True center-always True False vertical True False 950 400 True True never etched-in True True 20 48 1500 1500 True False False False center False -50 -50 True True 2 `

I have a PHP called GladeBase, that is used to build the screens from the gladefile above.
`<?php

class GladeBase {
public function load_glade($file) {
$this->window = new GtkBuilder();
$this->window->add_from_file($file);

    #print_r($this->window);

    $list_of_methods = get_class_methods($this);

    if (DEBUGGLADE) {
        echo print_r($list_of_methods, 1) . "\n\n";
    }

    for ($i = 0; $i < sizeof($list_of_methods); $i++) {

        if (DEBUGGLADE) {
            echo $list_of_methods[$i] . "\n";
        }

        if (strstr($list_of_methods[$i], "on_")) {
            if (preg_match('/on_(.+?)__(.+)$/', $list_of_methods[$i], $values)) {
                $widgetName = $values[1];
                $widget = $this->get_widget($widgetName);
                $signal = $values[2];
                $signal = str_replace('_', '-', $signal);

                if (DEBUGGLADE) {
                    echo $widgetName . " -> " . $signal . " -> " . $list_of_methods[$i] . "\n";
                }
                
                $widget->connect($signal, array($this, $list_of_methods[$i]));
                
            }
            else if (preg_match('/on_(.+?_.+)_(.+)$/', $list_of_methods[$i], $values)) {
                $widgetName = $values[1];
                $widget = $this->get_widget($widgetName);
                $signal = $values[2];

                if (DEBUGGLADE) {
                    echo $widgetName . " -> " . $signal . " -> " . $list_of_methods[$i] . "\n";
                }
                
                $widget->connect($signal, array($this, $list_of_methods[$i]));
                
            }
            else if (preg_match('/on_(.+?)_(.+?)$/', $list_of_methods[$i], $values)) {
                $widgetName = $values[1];
                $widget = $this->get_widget($widgetName);
                $signal = $values[2];

                if (DEBUGGLADE) {
                    echo $widgetName . " -> " . $signal . " -> " . $list_of_methods[$i] . "\n";
                }
                
                $widget->connect($signal, array($this, $list_of_methods[$i]));
            }
        }
    }

    if (DEBUGGLADE) {
        echo "\n\n";
    }

}

public function get_widget($widget) {
    return $this->window->get_object($widget);
}

public function BuildWindow($parent, $gladefile) {
    global $mainapp;

    if (DEBUGGLADE || DEVELOPMENT || OUTPUTLOG) {
        echo "Building windowname: " . $this->windowname . "\n";
        echo "Current memory usage: " . round(memory_get_usage()/1024, 2) . " KiB\n";
    }

    $this->windowShowed = false;

    // De actionTimeout weer op nul zetten
    $mainapp->actionTimeout = 0;

    $this->load_glade($gladefile);

    $this->childwindows = array();
    if (!is_string($parent)) {
        $this->parent = $parent;
        $this->parent->childwindows[$this->windowname] = $this;

        if (DEBUGGLADE || DEVELOPMENT || OUTPUTLOG) {
            echo "Added " . $this->windowname . " to " . $this->parent->windowname . "\n";
            echo "New memory usage: " . round(memory_get_usage()/1024, 2) . " KiB\n";
            echo "\n";
        }
    }
    else {
        if (DEBUGGLADE || DEVELOPMENT || OUTPUTLOG) {
            echo "Opened " . $this->windowname . "\n";
            echo "New memory usage: " . round(memory_get_usage()/1024, 2) . " KiB\n";
            echo "\n";
        }
    }

    $this->get_widget($this->windowname)->add_events(GdkEventMask::POINTER_MOTION_MASK);
    $this->get_widget($this->windowname)->connect("motion_notify-event", array($this, "MouseMove"));
    $this->get_widget($this->windowname)->connect("delete-event", array($this, "DeleteWindow"));
    $this->get_widget($this->windowname)->connect("destroy", array($this, "WindowDestroyed"));

    $this->get_widget($this->windowname)->connect("key-press-event", array($this, "KeyPressed")); 

    return true;
}

public function KeyPressed($widget, $event) {
    global $mainapp;

    // De actionTimeout weer op nul zetten
    $mainapp->LoginTimeoutCounter = 0;

    if (isset($eventArray->type) && $eventArray->type == 3) {
        // Mouse Move
        return true;
    }

    if (isset($eventArray->key->keyval)) {
        if ($eventArray->key->keyval === 65481) {
            // Als we op F12 drukken gaan we uitloggen en het loginscherm tonen
            $mainapp->EmployeeLogin();
        }
    }
    return false;
}

public function MouseMove($widget, $event) {
    $this->KeyPressed($widget, $event);
}

public function ShowWindow($setAsActiveWindow = true) {
    global $mainapp;

    $this->windowShowed = true;

    if (DEVELOPMENT) {
        $title = $this->get_widget($this->windowname)->get_title();

        if (strpos($title, "DEVELOPMENT") === false) {
            $this->get_widget($this->windowname)->set_title("DEVELOPMENT || " . $title . " || DEVELOPMENT");
        }
    }
    
    if (isset($this->parent)) {
        $this->get_widget($this->windowname)->set_transient_for($this->parent->get_widget($this->parent->windowname));
        $this->get_widget($this->windowname)->set_position(GTK::WIN_POS_CENTER_ON_PARENT);

        if (DEVELOPMENT || OUTPUTLOG) {
            echo "Showing " . $this->windowname . " (child from " . $this->parent->windowname . ")\n";
        }
    } else {
        if (DEVELOPMENT || OUTPUTLOG) {
            echo "Showing " . $this->windowname . " (godfather window)\n";
        }
    }

    if ($setAsActiveWindow) {
        $mainapp->activeWindow = $this;
    }

    if (DEVELOPMENT || OUTPUTLOG) {
        echo "Active window: " . $mainapp->activeWindow->windowname . "\n";
        echo "\n";
    }

    $this->get_widget($this->windowname)->show();

    return true;
}

public function AddIdToTitle($id) {
    $id = strval($id);
    if (strlen($id) > 0) {
        $title = $this->get_widget($this->windowname)->get_title();
        $this->get_widget($this->windowname)->set_title($title . " (id: " . $id . ")");
    }
    return true;
}

public function DeleteWindow() {
    // Dit is de functie die het scherm destroyed, mits de functie false returnd
    // We kunnen hiermee dus een alternatief iets uit laten voeren met het rode kruisje
    return false;
}

public function WindowDestroyed() {
    global $mainapp;
    // Dit is de functie die uitgevoerd wordt nadat het window destroyed is
    // de class is hier nog wel beschikbaar
    if (isset($this->parent)) {

        if (DEVELOPMENT || OUTPUTLOG) {
            echo "Removing " . $this->windowname . " from " . $this->parent->windowname . "\n";
            echo "Current memory usage: " . memory_get_usage() . "\n";

        }

        $this->parent->childwindows[$this->windowname] = null;
        unset($this->parent->childwindows[$this->windowname]);

        if ($mainapp->activeWindow->windowname !== $this->parent->windowname) {
            $this->parent->get_widget($this->parent->windowname)->present();
        }

        $mainapp->activeWindow = $this->parent;

        if (DEVELOPMENT || OUTPUTLOG) {
            echo "Active window: " . $mainapp->activeWindow->windowname . "\n";
            echo "New memory usage: " . memory_get_usage() . "\n";
            echo "\n";
        }
    }
}

public function EchoParentNames() {
    if (isset($this->parent)) {
        echo "" . $this->windowname . " = " . $this->get_widget($this->windowname)->get_transient_for()->get_title() . "\n";
        $this->parent->EchoParentNames();
    } else {
        echo "" . $this->windowname . " = no parent found\n";
    }
}

public function __destruct() {
    foreach ($this as $index => &$value) {
        $value = null;
        unset($this->{$index});
    }
    unset($value);
}

public function CloseChildWindows() {
    if (isset($this->childwindows) && is_array($this->childwindows)) {
        foreach ($this->childwindows as $windowName => $window) {
            $window->get_widget($windowName)->destroy();
        }
    }
}

public function FlushGlade() {
    while (Gtk::events_pending()) {
        Gtk::main_iteration();
    }

    return true;
}

}

?>`

Next I have a per-screen class that extends de GladeBase class, this runs the per-screen based code. Currently only working with one screen until I can get it to run stable.
`class MainApp extends GladeBase {

var $window;
var $windowname = "MainApp";

public function __construct() {
    global $datalayer, $mainapp;

    // Deze zetten we zodat we in alle classes het mainwindow kunnen benaderen
    $mainapp = $this;

    $this->BuildWindow("", "include/glade/" . $this->windowname . ".glade");

    $this->ShowWindow();

    $this->get_widget("textview_overlay")->set_visible(0);

    TreeView_Fill($this->get_widget("treeview_Preorders"), [], []);

}

?>
`

Function TreeView_Fill, simplified for testing purposes:
`

append_column($column1); echo "c"; $model = new GtkListStore(GObject::TYPE_STRING); echo "d"; $object->set_model($model); echo "e\n"; return true; ?>

`

Finaly I have a base file that starts the whole program:
`<?php

define("DEVELOPMENT", true);
define("DEBUGGLADE", false);

include("class.GladeBase.php");
include("function.Treeview_Fill.php");
include("class.MainApp.php");

Gtk::init();

$mainapp = new MainApp();

Gtk::main();

?>`

@Nijhuis
Copy link
Author

Nijhuis commented Nov 14, 2024

I see that pasting code in the comment section messes things up. If you have a e-mail address I can send the files to you.

@scorninpc
Copy link
Owner

you can send me all working code / files into scorninpc at google mail

Did you recreate the glade file or are you using the same of Gtk2? Look that Glade does not have full compatibility between versions

@Nijhuis
Copy link
Author

Nijhuis commented Nov 14, 2024

Thanks, I will send you the files.

I have rebuild the glade file with Glade User Interface Designer 3.40.

@scorninpc
Copy link
Owner

Thanks, I will send you the files.

I see, thank you

But i cannot find treeview_Preorders treeview inside MainApp.glade

@Nijhuis
Copy link
Author

Nijhuis commented Nov 14, 2024

My bad, had the names mixed up when cleaning up the files. This has to be treeview_Statistieken in class.MainApp.php.

@scorninpc
Copy link
Owner

is that the problem?

image

@Nijhuis
Copy link
Author

Nijhuis commented Nov 15, 2024

This doesnt look like a PHP error, what is the exact problem here?

@scorninpc
Copy link
Owner

but this is the error that you are facing?

because look:

<?php

Gtk::init();

$builder = \GtkBuilder::new_from_file("./MainApp.glade");


$builder->get_object("MainApp")->show();

$trv = $builder->get_object("treeview_Statistieken");

$column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 0);
$trv->append_column($column1);

$model = new GtkListStore(GObject::TYPE_STRING);
$trv->set_model($model);

$builder->get_object("MainApp")->show_all();

Gtk::main();

works fine. I think you are refering MainApp class alot times, and this is a GladeBase subclass. You made $mainapp global, and set $this to. And to set actived class you refere $this again, but use $mainapp. My bet is that you are using wrong reference in some point and GtkBuilder are trying to free referenced object

Anyway, your problem are when you set_model, not column related

It's dificulte to parse your code to find the problem, sorry

@Nijhuis
Copy link
Author

Nijhuis commented Nov 15, 2024

I dont know if that is the error I am facing, how can I get that debug info? I dont get any error messages, PHP just quits without any error message. It also dont quits every time, it crashes at random starts.

I just get this output and then it quits:
(php.exe:1872): Gtk-WARNING **: 20:22:43.565: Theme parsing error: gtk.css:1600:18: Not using units is deprecated. Assuming 'px'.
(php.exe:1872): Gtk-WARNING **: 20:22:43.569: Theme parsing error: gtk.css:2770:65: 'transparant' is not a valid color name

The code you are running is by far not the same as my code, but even the code below crashes at random starts.

`<?php

Gtk::init();

$builder = \GtkBuilder::new_from_file("./MainApp.glade");

$builder->get_object("MainApp")->show();

$builder->get_object("textview_overlay")->set_visible(0);

$trv = $builder->get_object("treeview_Statistieken");

$column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 0);
$trv->append_column($column1);

$model = new GtkListStore(GObject::TYPE_STRING);
$trv->set_model($model);

Gtk::main();`

Thanks for you help!

@scorninpc
Copy link
Owner

debug are on by default, the prove is that you are getting warning of themes. Your code not crashing, it's exiting ...

@Nijhuis
Copy link
Author

Nijhuis commented Nov 15, 2024

Well the result is the same, it is stopping for an unknown reason at random. Every 4 to 5 starts it is stopping when it is not supposed to.

Any ideas how to debug this?

@scorninpc
Copy link
Owner

this is random crashing before set model?

Sorry but you cannot debug glade iinternals =/

My best try was rewrite a simplest code and see if this work

@Nijhuis
Copy link
Author

Nijhuis commented Nov 18, 2024

Dit some more testing with code below. When it quits/crashes it gets to L21, but neither the widget "textview_overlay" is hidden, nor is widget "treeview_Statistieken" filled. It looks like when it hits Gtk::main() it just quits in stead of keeping the script running.

<?php

echo "L:" . __LINE__ . "\n";
Gtk::init();
echo "L:" . __LINE__ . "\n";
$builder = \GtkBuilder::new_from_file("./include/glade/MainApp.glade");
echo "L:" . __LINE__ . "\n";
$builder->get_object("MainApp")->show();
echo "L:" . __LINE__ . "\n";
$builder->get_object("textview_overlay")->set_visible(0);
echo "L:" . __LINE__ . "\n";
$trv = $builder->get_object("treeview_Statistieken");
echo "L:" . __LINE__ . "\n";
$column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 1);
echo "L:" . __LINE__ . "\n";
$trv->append_column($column1);
echo "L:" . __LINE__ . "\n";
$model = new GtkListStore(GObject::TYPE_STRING);
echo "L:" . __LINE__ . "\n";
$trv->set_model($model);
echo "L:" . __LINE__ . "\n";
Gtk::main();
echo "L:" . __LINE__ . "\n";

Output;

L:3
L:5

(php.exe:11936): Gtk-WARNING **: 15:31:32.009: Theme parsing error: gtk.css:1600:18: Not using units is deprecated. Assuming 'px'.

(php.exe:11936): Gtk-WARNING **: 15:31:32.009: Theme parsing error: gtk.css:2770:65: 'transparant' is not a valid color name
L:7
L:9
L:11
L:13
L:15
L:17
L:19
L:21

@scorninpc
Copy link
Owner

scorninpc commented Nov 18, 2024

first, if you are adding the first column, you need to pass 0, not 1

change
$column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 1);
to
$column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 1);

another common error, is show window at start. Gtk cannot propagate this event if something change. Preffer show_all() before main();

image

I dont know if it's will help, but if I change the GtkFixed to a GtkBox, all appear to works fine

image

image

I'll do some more tests with GtkFixed

@scorninpc
Copy link
Owner

scorninpc commented Nov 18, 2024

I do a new Glade with the same php script, and all works fine

image

Try my glade file test1.zip

@Nijhuis
Copy link
Author

Nijhuis commented Nov 18, 2024

First: You are right, I am passing a 0 to the GtkTreeViewColumn, the 1 was suggested before so I tried this as well. This didnt affect the problems I experience.

Second: I cant really use show_all, as I have glade files where certain elements are hidden by default. Show all will make them visible. Since I have over 100 glade files, with aprox over 1000 hidden elements this is not really something I would prefer.

Third: I will do some extra tests as well.

Fourth: I have done some testing with your Glade and PHP file, this does crash/quits as well every once in a while. Using show_all() in stead of show() does not make a difference for me. If it crashes it will show the window, with the widgets and the treeview filled. It shows the windows-loading-mouse-icon for a few seconds an then it just quits.

@scorninpc
Copy link
Owner

I understand about visibility, I didn't imagine that would be the case

@subabrain my man, can I ask you a favor? can you try run this test on windows machine? test1.zip as i cannot reproduce the problem? maybe this is a windows problem

@Nijhuis
Copy link
Author

Nijhuis commented Nov 18, 2024

Just to be clear, I ran the following code. In all four combinations:

  1. show() with set_visible(0)
  2. show() without set_visible(0)
  3. show_all() with set_visible(0)
  4. show_all() without set_visible(0)
<?php

echo "L:" . __LINE__ . "\n";
Gtk::init();
echo "L:" . __LINE__ . "\n";
$builder = \GtkBuilder::new_from_file("./include/glade/main.glade");
echo "L:" . __LINE__ . "\n";
#$builder->get_object("MainApp")->show();
echo "L:" . __LINE__ . "\n";
#$builder->get_object("textview_overlay")->set_visible(0);
echo "L:" . __LINE__ . "\n";
$trv = $builder->get_object("treeview_Statistieken");
echo "L:" . __LINE__ . "\n";
$column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 0);
echo "L:" . __LINE__ . "\n";
$trv->append_column($column1);
echo "L:" . __LINE__ . "\n";
$model = new GtkListStore(GObject::TYPE_STRING);
echo "L:" . __LINE__ . "\n";
$trv->set_model($model);
echo "L:" . __LINE__ . "\n";
$builder->get_object("MainApp")->show_all();
echo "L:" . __LINE__ . "\n";
Gtk::main();
echo "L:" . __LINE__ . "\n";

@scorninpc
Copy link
Owner

Yeh! lets focus on windows, because i cannot reproduce the problem on linux

image

I'll try to run a virtual machine

@scorninpc
Copy link
Owner

@Nijhuis can you do one more test for me?

<?php

echo "L:" . __LINE__ . "\n";
Gtk::init();
echo "L:" . __LINE__ . "\n";
$builder = \GtkBuilder::new_from_file("./include/glade/main.glade");
echo "L:" . __LINE__ . "\n";
#$builder->get_object("MainApp")->show();
echo "L:" . __LINE__ . "\n";
#$builder->get_object("textview_overlay")->set_visible(0);
echo "L:" . __LINE__ . "\n";

/**
 * does not use treevew of glade, 
 */
// $trv = $builder->get_object("treeview_Statistieken");
$trv = new GtkTreeView();
$builder->get_object("scrolledwindow1")->add($trv);

echo "L:" . __LINE__ . "\n";
$column1 = new GtkTreeViewColumn("Name", new GtkCellRendererText(), "text", 0);
echo "L:" . __LINE__ . "\n";
$trv->append_column($column1);
echo "L:" . __LINE__ . "\n";
$model = new GtkListStore(GObject::TYPE_STRING);
echo "L:" . __LINE__ . "\n";
$trv->set_model($model);
echo "L:" . __LINE__ . "\n";
$builder->get_object("MainApp")->show_all();
echo "L:" . __LINE__ . "\n";
Gtk::main();
echo "L:" . __LINE__ . "\n";

I'm discarding Treeview for glade, and creating a new one, and adding inside the scrolledwindow

@Nijhuis
Copy link
Author

Nijhuis commented Nov 18, 2024

After deleting treeview_Statistieken from main.glade it seems like this code is working just fine. Could not get it to crash up until now.

@scorninpc
Copy link
Owner

After deleting treeview_Statistieken from main.glade it seems like this code is working just fine. Could not get it to crash up until now.

as i suspected. it seems glade bind doesn't work well with many correlated sub items, as we can see on gtktreeview (treeview, columns, coluns renderes, models, etc etc)

i done the test creating columns and model inside glade, and appear to be fine too

i'll make some more tests to see if i can help a little more

@Nijhuis
Copy link
Author

Nijhuis commented Nov 26, 2024

Having more problems with treeviews. For every record added to the treeview I use $column->set_cell_data_func($cellRenderer, "Treeview_SetCellFormat", $colKey);

function Treeview_SetCellFormat($column, $renderer, $model, $iter, $colKey) {

    $path = $model->get_path($iter);
  
    $val = $model->get_value($iter, $colKey);
    if (isset($colVal["selector"])) {
  
    } else {
        $renderer->set_property("markup", $val);
    }
  
    $row_color = ($path % 2 == 1) ? "#dddddd" : "#ffffff";
    $renderer->set_property("cell-background", $row_color);
    $renderer->set_property("height", "25");
  
    return true;
}

But code above doesnt work, because of the two $renderer->set_property calls, when I run just one of those (either one) it works.

@scorninpc
Copy link
Owner

I dont got the problem, sorry.

If i understand corretly, this test can prove that each column has they own callback

image

Look: if col == 1 style with one collor, if col == 0 another ones

Is this the case?

@Nijhuis
Copy link
Author

Nijhuis commented Nov 26, 2024

Yes sort of, in my code every even row gets one color and every odd row gets another. That part works. But when I try to set the second property it just quits. Setting just one (doesnt matter which) works fine.

Please try this code, for me it only shows 2 entries.

image

<?php

Gtk::init();
$builder = \GtkBuilder::new_from_file("./include/glade/main.glade");

$trv = new GtkTreeView();
$builder->get_object("scrolledwindow1")->add($trv);

$cellRenderer1 = new GtkCellRendererText();
$cellRenderer2 = new GtkCellRendererText();

$column = new GtkTreeViewColumn("Firstname", $cellRenderer1, "text", 0);
$column->set_cell_data_func($cellRenderer1, "cell_data_func", 0);
$trv->append_column($column);

$column = new GtkTreeViewColumn("Lastname", $cellRenderer2, "text", 1);
$column->set_cell_data_func($cellRenderer2, "cell_data_func", 1);
$trv->append_column($column);

$model = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING);
$trv->set_model($model);

for ($i = 1; $i <= 10; $i++) {
    $model->append(["OK <b>" . $i . "</b>", "" . ($i * 1000) . ""]);
}

$builder->get_object("MainApp")->show_all();

Gtk::main();


function cell_data_func($column, $renderer, $model, $iter, $columnnr) {

    $path = $model->get_path($iter);

    $val = $model->get_value($iter, $columnnr);
    if (isset($colVal["selector"])) {

    } else {
        $renderer->set_property("markup", $val);
    }

    $row_color = ($path % 2 == 1) ? "#dddddd" : "#ffffff";
    $renderer->set_property("cell-background", $row_color);
    $renderer->set_property("height", "50");

    return true;
}

@scorninpc
Copy link
Owner

scorninpc commented Nov 26, 2024

send me your glade file here please

By your picture, your treeview does not have scroll

and you have a error on $val = $model->get_value($iter, $columnnr);. $column is the correct var name, but i think you want to use $colKey

@Nijhuis
Copy link
Author

Nijhuis commented Nov 26, 2024

It is the same gladefile as posted november 18th. But you where right, they get shown correctly, there just was no scrollbar visible.

My problems are way more random. These small glade files and scripts seem to be running stable, and if it quits it always quits at the same point.

Unfortunately this dont seem to be the case with larger scripts. It seems to me as if GTK is just to unstable when running larger pieces of code/glade files. One moment the code runs just fine, the next moment (without editing any code) it just randomly quits at some point.

Will keep testing some more.

@scorninpc
Copy link
Owner

My problems are way more random. These small glade files and scripts seem to be running stable, and if it quits it always quits at the same point.

We don't do any data analysis or processing. If you look at C code, we are just getting parameters and passing them to C functions. So small or big code doesn't matter.

Unfortunately this dont seem to be the case with larger scripts. It seems to me as if GTK is just to unstable when running larger pieces of code/glade files. One moment the code runs just fine, the next moment (without editing any code) it just randomly quits at some point.

This is the main problem: we start the project without verifying if params or data type are correct (this is why this project is in dev stage yet) . So sometimes you pass a wrong type or forgot some param, and it's work but with a bad GTK memory alocation. This is the main cause of crashs.

As you are porting a large project, some params changed and someother dont exists anymore, so port Gtk2 to Gtk3 is not a easy piece like "try and run"

@Nijhuis
Copy link
Author

Nijhuis commented Nov 27, 2024

I understand this is still in development, but what I dont understand is when I am running the exact same code ten times, I have about 4 to 6 different outcomes.

If a parameter is missing, or of the wrong datatype, this should result in the same outcome everytime. Right?

@scorninpc
Copy link
Owner

scorninpc commented Nov 27, 2024

If a parameter is missing, or of the wrong datatype, this should result in the same outcome everytime. Right?

No, sometimes memory is alocated with random value or alocated with old value of the memory in this space.

Sometimes works, sometimes works wrong, sometimes break. Memory is a pain when we work with c/cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants