Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8734973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:57:05+00:00 2026-06-13T09:57:05+00:00

I am programming a multi-threaded chat server application. Thus critical section are very necessary.

  • 0

I am programming a multi-threaded chat server application. Thus critical section are very necessary. I just made a wrapper class for threaded tree view. It works perfectly in the client but the server raises an AV.

There are two forms, FormServer (which practically does almost no processing except for gui painting) and the DataModuleServer which does all the heavy lifting.

The FormServer gets created first.

Actually the threaded tree view is inside another wrapper class TRoomTree.

TDataModuleServer.Create

procedure TDataModuleServer.cr(Sender: TObject);
begin
  Rooms := TRoomTree.Create (FormServer.tvRooms);

tvRooms : the visual treeview

TRoomTree.Create

constructor TRoomTree.Create (TV : TTreeView);
begin

  if Assigned (TV) then
    fTreeView.Create (TV)
  else
    exit;

fTreeView : the threaded tree view;

TThreadTreeView.Create

constructor TThreadTreeView.Create (TreeView : TTreeView = nil);
begin

  fLock := TCriticalSection.Create;

  if Assigned (TreeView) then
    fTreeView := TreeView
  else
    fTreeView := TTreeView.Create (nil);

end;

fTreeView : the normal tree view;

Now the TCriticalSection.Create raises an AV exception in ntdll.dll.

Call Stack

:76cac41f KERNELBASE.RaiseException + 0x58
:0040469c NotifyNonDelphiException + $1C
:77ecb42b ; ntdll.dll
uThreadTreeView.TThreadTreeView.Create($26B4300) 
uRoomTree.TRoomTree.Create($26B4300)
uServer.TDataModuleServer.cr($26A48B0)
Classes.TDataModule.DoCreate
Classes.TDataModule.AfterConstruction
System.@AfterConstruction($26A48B0)
Classes.TDataModule.Create(???)
Forms.TApplication.CreateForm(???,(no value))
PlayburnServer.PlayburnServer
:773833aa kernel32.BaseThreadInitThunk + 0x12
:77ea9ef2 ntdll.RtlInitializeExceptionChain + 0x63
:77ea9ec5 ntdll.RtlInitializeExceptionChain + 0x36

Any help will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:57:06+00:00Added an answer on June 13, 2026 at 9:57 am

    In TRoomTree.Create, this line of code

    fTreeView.Create(TV);
    

    is responsible for your access violation. That’s because fTreeView has not been initialised before you attempt to call a method on it.

    Delphi instances are created like this:

    fTreeView := TThreadTreeView.Create(TV);
    

    I’m not sure about your threading model, but I trust you are aware that VCL controls must only be accessed from the GUI thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am programming a concurrent (multi-threaded) server application - using pthread, of cource!- when
I've implemented a simple multi-threaded HTTP server for my programming assignment a couple weeks
I am just starting to look into multi-threaded programming and thread safety. I am
I am reading up on multi-threaded programming in Java. In the java book it
For a multi-player programming game, I'm working on a background compilation server for Scala
I'm writing a TCP chat server ( programming language does not mather ). It's
I have read that select and multi-threaded programming were low performing IO models, for
I am writing a multi-threaded .Net application in which many callers need to concurrently
I'm new at multi-threaded programming and I tried to code the Bakery Lock Algorithm
I am writing a multi-threaded application in Java in order to improve performance over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.